Fix nullptr crash in -Wthread-safety-beta

llvm-svn: 252107
This commit is contained in:
Reid Kleckner 2015-11-05 00:24:01 +00:00
parent a6bc55613e
commit 0626919015
2 changed files with 8 additions and 1 deletions

View File

@ -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();

View File

@ -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("");
};