Cleanups for printing the terminators of CFGBlocks for "?", "||", and "&&" operators.
llvm-svn: 41654
This commit is contained in:
parent
78502cf4c9
commit
7f7dd7602c
|
@ -960,7 +960,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class CFGBlockTerminatorPrint : public StmtVisitor<CFGBlockTerminatorPrint,
|
class CFGBlockTerminatorPrint : public StmtVisitor<CFGBlockTerminatorPrint,
|
||||||
void > {
|
void >
|
||||||
|
{
|
||||||
std::ostream& OS;
|
std::ostream& OS;
|
||||||
StmtPrinterHelper* Helper;
|
StmtPrinterHelper* Helper;
|
||||||
public:
|
public:
|
||||||
|
@ -974,7 +975,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default case.
|
// Default case.
|
||||||
void VisitStmt(Stmt* S) { S->printPretty(OS,Helper); }
|
void VisitStmt(Stmt* S) { S->printPretty(OS); }
|
||||||
|
|
||||||
void VisitForStmt(ForStmt* F) {
|
void VisitForStmt(ForStmt* F) {
|
||||||
OS << "for (" ;
|
OS << "for (" ;
|
||||||
|
@ -1004,6 +1005,31 @@ public:
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VisitConditionalOperator(ConditionalOperator* C) {
|
||||||
|
C->getCond()->printPretty(OS,Helper);
|
||||||
|
OS << " ? ... : ...\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void VisitBinaryOperator(BinaryOperator* B) {
|
||||||
|
if (!B->isLogicalOp()) {
|
||||||
|
VisitExpr(B);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
B->getLHS()->printPretty(OS,Helper);
|
||||||
|
|
||||||
|
switch (B->getOpcode()) {
|
||||||
|
case BinaryOperator::LOr:
|
||||||
|
OS << " || ...\n";
|
||||||
|
return;
|
||||||
|
case BinaryOperator::LAnd:
|
||||||
|
OS << " && ...\n";
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
assert(false && "Invalid logical operator.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VisitExpr(Expr* E) {
|
void VisitExpr(Expr* E) {
|
||||||
E->printPretty(OS,Helper);
|
E->printPretty(OS,Helper);
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
|
|
Loading…
Reference in New Issue