forked from OSchip/llvm-project
Add CFG support for @synchronized. This fixes <rdar://problem/6848820>.
llvm-svn: 70620
This commit is contained in:
parent
e6b424e53a
commit
49805454e6
|
@ -140,9 +140,7 @@ public:
|
|||
// a 'return'.
|
||||
CFGBlock* VisitObjCAtThrowStmt(ObjCAtThrowStmt* S);
|
||||
|
||||
CFGBlock* VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S){
|
||||
return NYS();
|
||||
}
|
||||
CFGBlock* VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S);
|
||||
|
||||
// Blocks.
|
||||
CFGBlock* VisitBlockExpr(BlockExpr* E) { return NYS(); }
|
||||
|
@ -935,6 +933,16 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
|
|||
return addStmt(S->getCollection());
|
||||
}
|
||||
|
||||
CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
|
||||
// FIXME: Add locking 'primitives' to CFG for @synchronized.
|
||||
|
||||
// Inline the body.
|
||||
Visit(S->getSynchBody());
|
||||
|
||||
// Inline the sync expression.
|
||||
return Visit(S->getSynchExpr());
|
||||
}
|
||||
|
||||
CFGBlock* CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt* S) {
|
||||
return NYS();
|
||||
}
|
||||
|
|
|
@ -271,3 +271,11 @@ typedef NSString* WonkyTypedef;
|
|||
void test_isTrackedObjectType(void) {
|
||||
NSString *str = [TestIsTracked newString]; // expected-warning{{Potential leak}}
|
||||
}
|
||||
|
||||
// Test @synchronized
|
||||
void test_synchronized(id x) {
|
||||
@synchronized(x) {
|
||||
NSString *string = [[NSString stringWithFormat:@"%ld", (long) 100] retain]; // expected-warning {{leak}}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue