[clang] [clang][ThreadSafety] Invalidate modified capability aliases (PR #244334)

Bart Van Assche via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 12:19:57 PST 2026


================
@@ -496,11 +558,28 @@ class LocalVariableMap {
     return nullptr;
   }
 
+  /// Look up the definition of \p D if the value of \p D is known to equal
+  /// its last definition. Use this when evaluating the value of a variable,
+  /// e.g. a trylock result.
+  const Expr *lookupValueExpr(const NamedDecl *D, Context &Ctx) const {
+    if (Ctx.isEmpty() || !hasTrackableValue(D))
+      return nullptr;
+    const unsigned *P = Ctx.lookup(D);
+    return P && !isClobbered(*P) ? lookupExpr(D, Ctx) : nullptr;
+  }
+
   Context getEmptyContext() { return ContextFactory.getEmptyMap(); }
 
+  /// If \p D has a definition in \p Ctx, return a context in which that
+  /// definition is cleared; otherwise return \p Ctx.
+  Context clearDefinitionIfSet(const NamedDecl *D, Context Ctx) {
+    return clearDefinition(D, Ctx);
+  }
+
----------------
bvanassche wrote:

Removed in the fixup commit.

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


More information about the cfe-commits mailing list