llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-modules

Author: None (smanna12)

<details>
<summary>Changes</summary>

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().

---
Full diff: https://github.com/llvm/llvm-project/pull/97221.diff


1 Files Affected:

- (modified) clang/lib/Serialization/ASTReaderDecl.cpp (+1) 


``````````diff
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp 
b/clang/lib/Serialization/ASTReaderDecl.cpp
index 6afb18f932e72..cf3737c5a501d 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -4215,6 +4215,7 @@ void ASTReader::PassInterestingDeclsToConsumer() {
   };
   std::deque<Decl *> MaybeInterestingDecls =
       std::move(PotentiallyInterestingDecls);
+  PotentiallyInterestingDecls.clear();
   assert(PotentiallyInterestingDecls.empty());
   while (!MaybeInterestingDecls.empty()) {
     Decl *D = MaybeInterestingDecls.front();

``````````

</details>


https://github.com/llvm/llvm-project/pull/97221
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to