[clang] [clang][ThreadSafety] Do not read a C field's address as a pointer to member (PR #231604)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 1 15:53:53 PST 2026


================

----------------
aaronpuchert wrote:

The problem is here:
```
FieldDecl referenced a 'int'
`-GuardedByAttr
  `-UnaryOperator 'struct Mutex *' prefix '&' cannot overflow
    `-DeclRefExpr 'struct Mutex' lvalue Field 'mu' 'struct Mutex' non_odr_use_unevaluated
```
We're referencing a field, so this should be a `MemberExpr` instead of a `DeclRefExpr`. Not sure what became of the C equivalent of `CXXThisExpr` that was proposed.

Adding workarounds in the Thread Safety Analysis just make it hard to maintain.

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


More information about the cfe-commits mailing list