[cfe-commits] r41654 - /cfe/trunk/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Fri Aug 31 14:49:40 PDT 2007
Author: kremenek
Date: Fri Aug 31 16:49:40 2007
New Revision: 41654
URL: http://llvm.org/viewvc/llvm-project?rev=41654&view=rev
Log:
Cleanups for printing the terminators of CFGBlocks for "?", "||", and "&&" operators.
Modified:
cfe/trunk/AST/CFG.cpp
Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=41654&r1=41653&r2=41654&view=diff
==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Fri Aug 31 16:49:40 2007
@@ -960,7 +960,8 @@
};
class CFGBlockTerminatorPrint : public StmtVisitor<CFGBlockTerminatorPrint,
-void > {
+ void >
+{
std::ostream& OS;
StmtPrinterHelper* Helper;
public:
@@ -974,7 +975,7 @@
}
// Default case.
- void VisitStmt(Stmt* S) { S->printPretty(OS,Helper); }
+ void VisitStmt(Stmt* S) { S->printPretty(OS); }
void VisitForStmt(ForStmt* F) {
OS << "for (" ;
@@ -1004,6 +1005,31 @@
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) {
E->printPretty(OS,Helper);
OS << '\n';
More information about the cfe-commits
mailing list