[clang] Thread Safety Analysis: Basic capability alias-analysis (PR #142955)

Marco Elver via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 6 05:50:37 PDT 2025


================
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
   IncompleteArgs.clear();
 }
 
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+  // Note: The search is performed lazily per-variable and result is cached. An
+  // alternative would have been to eagerly create a set of all reassigned
+  // variables, but that would consume significantly more memory. The number of
----------------
melver wrote:

> So we have to employ a hybrid strategy: ...

I think I figured out fixing loop-invariant aliases of LocalVariableMap, which means we could get rid of the isVariableReassigned hack. This is in the 2nd commit now, just to show the difference. 

https://github.com/llvm/llvm-project/pull/142955


More information about the cfe-commits mailing list