Block = createBlock(false);
Block->setTerminator(CFGTerminator(E, true));
+ assert(Block->getTerminator().isTemporaryDtorsBranch());
// See if this is a known constant.
const TryResult &KnownVal = tryEvaluateBool(E->getCond());
void VisitExpr(Expr *E) {
E->printPretty(OS, Helper, Policy);
}
+
+public:
+ void print(CFGTerminator T) {
+ if (T.isTemporaryDtorsBranch())
+ OS << "(Temp Dtor) ";
+ Visit(T.getStmt());
+ }
};
} // end anonymous namespace
PrintingPolicy PP(Helper.getLangOpts());
CFGBlockTerminatorPrint TPrinter(OS, &Helper, PP);
- TPrinter.Visit(const_cast<Stmt*>(B.getTerminator().getStmt()));
+ TPrinter.print(B.getTerminator());
OS << '\n';
if (ShowColors)
void CFGBlock::printTerminator(raw_ostream &OS,
const LangOptions &LO) const {
CFGBlockTerminatorPrint TPrinter(OS, NULL, PrintingPolicy(LO));
- TPrinter.Visit(const_cast<Stmt*>(getTerminator().getStmt()));
+ TPrinter.print(getTerminator());
}
Stmt *CFGBlock::getTerminatorCondition() {
// CHECK: [B3]
// CHECK: 1: [B5.8] && [B4.5]
// CHECK: 2: [B5.3]([B3.1])
-// CHECK: T: [B5.8] && ...
+// CHECK: T: (Temp Dtor) [B5.8] && ...
// CHECK: Preds (2): B4 B5
// CHECK: Succs (2): B2 B1
// CHECK: [B4]
// CHECK: [B7]
// CHECK: 1: [B9.5] && [B8.5]
// CHECK: 2: bool a = A() && B();
-// CHECK: T: [B9.5] && ...
+// CHECK: T: (Temp Dtor) [B9.5] && ...
// CHECK: Preds (2): B8 B9
// CHECK: Succs (2): B6 B5
// CHECK: [B8]
// CHECK: [B3]
// CHECK: 1: [B5.8] || [B4.5]
// CHECK: 2: [B5.3]([B3.1])
-// CHECK: T: [B5.8] || ...
+// CHECK: T: (Temp Dtor) [B5.8] || ...
// CHECK: Preds (2): B4 B5
// CHECK: Succs (2): B1 B2
// CHECK: [B4]
// CHECK: [B7]
// CHECK: 1: [B9.5] || [B8.5]
// CHECK: 2: bool a = A() || B();
-// CHECK: T: [B9.5] || ...
+// CHECK: T: (Temp Dtor) [B9.5] || ...
// CHECK: Preds (2): B8 B9
// CHECK: Succs (2): B5 B6
// CHECK: [B8]
// CHECK: 3: [B7.2]
// CHECK: 4: [B7.3] (CXXConstructExpr, class A)
// CHECK: 5: A a = B() ? A() : A(B());
-// CHECK: T: [B10.5] ? ... : ...
+// CHECK: T: (Temp Dtor) [B10.5] ? ... : ...
// CHECK: Preds (2): B8 B9
// CHECK: Succs (2): B5 B6
// CHECK: [B8]
// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK: 3: [B4.2]
// CHECK: 4: [B7.3]([B4.3])
-// CHECK: T: [B7.8] ? ... : ...
+// CHECK: T: (Temp Dtor) [B7.8] ? ... : ...
// CHECK: Preds (2): B5 B6
// CHECK: Succs (2): B2 B3
// CHECK: [B5]
// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK: 3: [B10.2]
// CHECK: 4: const A &a = B() ? A() : A(B());
-// CHECK: T: [B13.5] ? ... : ...
+// CHECK: T: (Temp Dtor) [B13.5] ? ... : ...
// CHECK: Preds (2): B11 B12
// CHECK: Succs (2): B8 B9
// CHECK: [B11]
// CHECK: 3: [B4.2]
// CHECK: 4: [B4.3] (CXXConstructExpr, class A)
// CHECK: 5: A a = A() ?: A();
-// CHECK: T: [B7.5] ? ... : ...
+// CHECK: T: (Temp Dtor) [B7.5] ? ... : ...
// CHECK: Preds (2): B5 B6
// CHECK: Succs (2): B2 B3
// CHECK: [B5]
// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK: 3: [B4.2]
// CHECK: 4: [B7.3]([B4.3])
-// CHECK: T: [B7.8] ? ... : ...
+// CHECK: T: (Temp Dtor) [B7.8] ? ... : ...
// CHECK: Preds (2): B5 B6
// CHECK: Succs (2): B2 B3
// CHECK: [B5]
// CHECK: 2: [B9.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK: 3: [B9.2]
// CHECK: 4: const A &a = A() ?: A();
-// CHECK: T: [B12.5] ? ... : ...
+// CHECK: T: (Temp Dtor) [B12.5] ? ... : ...
// CHECK: Preds (2): B10 B11
// CHECK: Succs (2): B7 B8
// CHECK: [B10]