Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.

Fixes <rdar://problem/7979430>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek 2010-05-13 16:38:08 +00:00
parent 6bfd533600
commit fadebbafe6
2 changed files with 11 additions and 2 deletions

View File

@ -1223,10 +1223,9 @@ CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
return 0;
Block = 0;
Succ = SyncBlock;
}
Succ = SyncBlock;
// Inline the sync expression.
return addStmt(S->getSynchExpr());
}

View File

@ -957,3 +957,13 @@ void pr6938_b() {
}) == 0) {
}
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7979430> - The CFG for code containing an empty
// @synchronized block was previously broken (and would crash the analyzer).
//===----------------------------------------------------------------------===//
void r7979430(id x) {
@synchronized(x) {}
}