diff options
-rw-r--r-- | include/clang/Analysis/Visitors/CFGRecStmtVisitor.h | 5 | ||||
-rw-r--r-- | test/Analysis/dead-stores.m | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h index 75a4ac6601..bb7cf0b97e 100644 --- a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h +++ b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h @@ -26,6 +26,11 @@ public: static_cast< ImplClass* >(this)->VisitChildren(S); } + void VisitCompoundStmt(CompoundStmt *S) { + // Do nothing. Everything in a CompoundStmt is inlined + // into the CFG. + } + void VisitConditionVariableInit(Stmt *S) { assert(S == this->getCurrentBlkStmt()); VarDecl *CondVar = 0; diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m index 701e5802b2..730b8266bd 100644 --- a/test/Analysis/dead-stores.m +++ b/test/Analysis/dead-stores.m @@ -41,3 +41,21 @@ void DeadStoreTest(NSObject *anObject) { void rdar_7631278(NSObject *x) { x = ((void*)0); } + +// This test case issuing a bogus warning for the declaration of 'isExec' +// because the compound statement for the @synchronized was being visited +// twice by the LiveVariables analysis. +BOOL baz_rdar8527823(); +void foo_rdar8527823(); +@interface RDar8527823 +- (void) bar_rbar8527823; +@end +@implementation RDar8527823 +- (void) bar_rbar8527823 +{ + @synchronized(self) { + BOOL isExec = baz_rdar8527823(); // no-warning + if (isExec) foo_rdar8527823(); + } +} +@end |