[clang] Thread Safety Analysis: Basic capability alias-analysis (PR #142955)
Marco Elver via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 2 09:15:40 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:
This test still fails:
```
--- a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -7361,6 +7361,17 @@ void testIndirectAccess(ContainerOfPtr *fc) {
ptr->mu.Unlock();
}
+void testControlFlowDoWhile0(Foo *f, int x) {
+ Foo *ptr = f;
+
+ f->mu.Lock();
+ if (x) {
+ do { } while (0);
+ }
+ ptr->data = 42;
+ ptr->mu.Unlock();
+}
+
```
Hmm...
https://github.com/llvm/llvm-project/pull/142955
More information about the cfe-commits
mailing list