Open
Description
Given the following code (full code in godbolt link below) Clang doesn't report any warnings for accessing b.some_field even though b.lock is not locked at any point (removing a.lock.acquire() + a.lock.release() calls makes the warning appear but that's obviously not something that you should have to do as they are two distinct objects):
struct CAPABILITY("spinlock") Spinlock {
void acquire() ACQUIRE();
void release() RELEASE();
};
struct Foo {
Spinlock lock;
bool some_field GUARDED_BY(lock);
};
void foobar() {
Foo a {};
Foo b {};
a.lock.acquire();
b.some_field = true;
a.lock.release();
}