[clang] [BoundsSafety][Clang][Sema][AST] Introduce CThisExpr for C __counted_by attributes (PR #199241)
Karthik P via cfe-commits
cfe-commits at lists.llvm.org
Sat May 30 23:00:37 PDT 2026
================
@@ -308,14 +308,14 @@ struct FPOps {
void test_fp_ops(struct FPOps *ops) {
ops->lock();
- ops->a = 42;
+ ops->a = 42; // expected-warning {{writing variable 'a' requires holding mutex 'ops->mu' exclusively}} expected-note {{found near match 'mu'}}
----------------
Caryoake wrote:
Since I introduced CThisExpr, it looks like the TSA evaluates the base context differently for C function pointers.
For field access, (ops->a), the SelfArg is set to ops and hence ops->mu.
But for function pointer call, (ops->lock()), TSA fails to extract the SelfArg. This forced the generic mu and hence the mismatch and false positive.
Im immediately reverting the changes in warn-thread-safety-analysis.c and fixing the Thread Safety Analyser
https://github.com/llvm/llvm-project/pull/199241
More information about the cfe-commits
mailing list