llvm-project
220bed3d - [Analysis] Fix missing destructor in CFG for C++20 range-for init-statement (#175859)

Commit
113 days ago
[Analysis] Fix missing destructor in CFG for C++20 range-for init-statement (#175859) In C++20 range-based for loops, variables declared in the init-statement were not correctly added to the CFG builder's local scope. Consequently, implicit destructors for these variables were missing from the CFG. This caused analyses relying on the CFG to incorrectly model the lifetime of these variables. Specifically, Thread Safety Analysis reported false positives for RAII locks declared in the init-statement. Fix it by calling addLocalScopeForStmt for the init-statement in CFGBuilder::VisitCXXForRangeStmt. This ensures destructors are correctly inserted into the CFG. Fixes: https://github.com/abseil/abseil-cpp/issues/1901
Author
Parents
Loading