forked from OSchip/llvm-project
Fix a horrible bug in all dataflow analyses that use CFGRecStmtVisitor (including live variables analysis).
We shouldn't recurse into CompoundStmts since they are already inlined in the CFG. This could result in bogus dead stores warnings (among other things). llvm-svn: 117162
This commit is contained in:
parent
7043fba7fa
commit
5c97605c1d
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue