aaronpuchert wrote:

The behavior of before/after is a bit weird in some cases, but I guess it's 
mostly used within the same class where it should be fine. Unlike the rest of 
the analysis, it doesn't work with expressions but strips them down to the bare 
`FieldDecl` or `VarDecl`. This has some weird side effects:

```c++
class Data {
public:
        Mutex mu;
};

class ContainsData {
        Data d1, d2;
        Mutex lm ACQUIRED_AFTER(d1.mu);

        void f() {
                lm.Lock();
                d1.mu.Lock();    // Warning: mutex 'mu' must be acquired before 
'lm' - Ok.
                d1.mu.Unlock();
                d2.mu.Lock();    // Warning: mutex 'mu' must be acquired before 
'lm' - False positive.
                d2.mu.Unlock();
                lm.Unlock();
        }
};
```

But I guess we can also fix that later.

https://github.com/llvm/llvm-project/pull/152853
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to