Skip to content

Commit 035e76f

Browse files
authored
[Serialization] Clear moved-from deque to ensure valid state post-move (#97221)
This patch addresses a use-after-move issue, reported by static analyzer tool, by clearing the `PotentiallyInterestingDecls` deque after it has been moved to `MaybeInterestingDecls`. The fix ensures that the subsequent assert statement correctly checks for an empty state, preventing any undefined behavior in ASTReader::PassInterestingDeclsToConsumer().
1 parent 9f04d75 commit 035e76f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4215,6 +4215,7 @@ void ASTReader::PassInterestingDeclsToConsumer() {
42154215
};
42164216
std::deque<Decl *> MaybeInterestingDecls =
42174217
std::move(PotentiallyInterestingDecls);
4218+
PotentiallyInterestingDecls.clear();
42184219
assert(PotentiallyInterestingDecls.empty());
42194220
while (!MaybeInterestingDecls.empty()) {
42204221
Decl *D = MaybeInterestingDecls.front();

0 commit comments

Comments
 (0)