зеркало из https://github.com/microsoft/clang-1.git
LiveVariables now updates the liveness state of block-level expressions that
are referenced by CFGBlock terminators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49798 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a760f5f7dc
Коммит
5cd24389af
|
@ -143,21 +143,58 @@ void TransferFuncs::Visit(Stmt *S) {
|
|||
}
|
||||
|
||||
void TransferFuncs::VisitTerminator(Stmt* S) {
|
||||
|
||||
Expr* E = NULL;
|
||||
|
||||
switch (S->getStmtClass()) {
|
||||
default:
|
||||
return;
|
||||
|
||||
for (Stmt::child_iterator I = S->child_begin(), E = S->child_end();
|
||||
I != E; ++I) {
|
||||
case Stmt::ForStmtClass:
|
||||
E = cast<ForStmt>(S)->getCond();
|
||||
break;
|
||||
|
||||
Stmt* Child = *I;
|
||||
if (!Child) continue;
|
||||
case Stmt::WhileStmtClass:
|
||||
E = cast<WhileStmt>(S)->getCond();
|
||||
break;
|
||||
|
||||
if (getCFG().isBlkExpr(Child)) {
|
||||
LiveState(Child, AD) = Alive;
|
||||
return; // Only one "condition" expression.
|
||||
}
|
||||
}
|
||||
case Stmt::DoStmtClass:
|
||||
E = cast<DoStmt>(S)->getCond();
|
||||
break;
|
||||
|
||||
case Stmt::IfStmtClass:
|
||||
E = cast<IfStmt>(S)->getCond();
|
||||
break;
|
||||
|
||||
case Stmt::ChooseExprClass:
|
||||
E = cast<ChooseExpr>(S)->getCond();
|
||||
break;
|
||||
|
||||
case Stmt::IndirectGotoStmtClass:
|
||||
E = cast<IndirectGotoStmt>(S)->getTarget();
|
||||
break;
|
||||
|
||||
case Stmt::SwitchStmtClass:
|
||||
E = cast<SwitchStmt>(S)->getCond();
|
||||
break;
|
||||
|
||||
case Stmt::ConditionalOperatorClass:
|
||||
E = cast<ConditionalOperator>(S)->getCond();
|
||||
break;
|
||||
|
||||
case Stmt::BinaryOperatorClass: // '&&' and '||'
|
||||
E = cast<BinaryOperator>(S)->getLHS();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!E)
|
||||
return;
|
||||
|
||||
E = E->IgnoreParens();
|
||||
|
||||
assert (getCFG().isBlkExpr(E));
|
||||
LiveState(E, AD) = Alive;
|
||||
}
|
||||
|
||||
void TransferFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
|
||||
if (VarDecl* V = dyn_cast<VarDecl>(DR->getDecl()))
|
||||
|
|
Загрузка…
Ссылка в новой задаче