forked from OSchip/llvm-project
Fix nullptr crash in -Wthread-safety-beta
llvm-svn: 252107
This commit is contained in:
parent
a6bc55613e
commit
0626919015
|
@ -287,7 +287,7 @@ public:
|
|||
}
|
||||
|
||||
const ValueDecl* valueDecl() const {
|
||||
if (Negated)
|
||||
if (Negated || CapExpr == nullptr)
|
||||
return nullptr;
|
||||
if (auto *P = dyn_cast<til::Project>(CapExpr))
|
||||
return P->clangDecl();
|
||||
|
|
|
@ -5182,3 +5182,10 @@ void test() {
|
|||
|
||||
} // end namespace LockableUnions
|
||||
|
||||
// This used to crash.
|
||||
class acquired_before_empty_str {
|
||||
void WaitUntilSpaceAvailable() {
|
||||
lock_.ReaderLock(); // expected-note {{acquired here}}
|
||||
} // expected-warning {{mutex 'lock_' is still held at the end of function}}
|
||||
Mutex lock_ ACQUIRED_BEFORE("");
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue