>From 3edd09f354470a8f637f91841310c01fff153c44 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erikjv@me.com>
Date: Mon, 30 Jan 2012 11:34:42 +0100
Subject: [PATCH] [CFG] When adding a return statement to the CFG, add
 implicit destructors in a separate block after the block
 with the return statement. This results in blocks ending in
 with a terminator statement.

---
 include/clang/Analysis/CFG.h                |    8 +-
 lib/Analysis/CFG.cpp                        |   14 +-
 lib/Sema/AnalysisBasedWarnings.cpp          |    9 +
 test/Analysis/auto-obj-dtors-cfg-output.cpp |  385 ++++++++++++++-------------
 4 files changed, 228 insertions(+), 188 deletions(-)

diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h
index 27b22b8..8f8f680 100644
--- a/include/clang/Analysis/CFG.h
+++ b/include/clang/Analysis/CFG.h
@@ -296,10 +296,10 @@ class CFGBlock {
     const_reverse_iterator rbegin() const { return Impl.begin(); }
     const_reverse_iterator rend() const { return Impl.end(); }
 
-   CFGElement operator[](size_t i) const  {
-     assert(i < Impl.size());
-     return Impl[Impl.size() - 1 - i];
-   }
+    CFGElement operator[](size_t i) const {
+      assert(i < Impl.size());
+      return Impl[Impl.size() - 1 - i];
+    }
 
     size_t size() const { return Impl.size(); }
     bool empty() const { return Impl.empty(); }
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index 50393b6..6ae5e8f 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -1605,9 +1605,21 @@ CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) {
   Block = createBlock(false);
 
   // The Exit block is the only successor.
-  addAutomaticObjDtors(ScopePos, LocalScope::const_iterator(), R);
   addSuccessor(Block, &cfg->getExit());
 
+  if (BuildOpts.AddImplicitDtors) {
+    // Add the automatic Dtors to the new (last) block.
+    addAutomaticObjDtors(ScopePos, LocalScope::const_iterator(), R);
+
+    // Then create a new block, which will have the return as terminator and the
+    // Dtor block as successor.
+    if (!Block->empty()) {
+      CFGBlock *ReturnBlock = createBlock(false);
+      addSuccessor(ReturnBlock, Block);
+      Block = ReturnBlock;
+    }
+  }
+
   // Add the return statement to the block.  This may create new blocks if R
   // contains control-flow (short-circuit operations).
   return VisitStmt(R, AddStmtChoice::AlwaysAdd);
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index e2d1e8c..8101f66 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -152,6 +152,15 @@ static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) {
     for ( ; ri != re ; ++ri)
       if (isa<CFGStmt>(*ri))
         break;
+    // The block might have been a "clean-up block" with destructors after a
+    // block with a return. So check the Predecessor block to see if it ends
+    // with a return.
+    if (B.pred_size() == 1) {
+      CFGBlock::const_reverse_iterator i = (*B.pred_begin())->rbegin();
+      if (const CFGStmt *stmt = dyn_cast<const CFGStmt>(i))
+        if (isa<ReturnStmt>(stmt->getStmt()))
+          ri = i;
+    }
 
     // No more CFGElements in the block?
     if (ri == re) {
diff --git a/test/Analysis/auto-obj-dtors-cfg-output.cpp b/test/Analysis/auto-obj-dtors-cfg-output.cpp
index 2402e00..86e0617 100644
--- a/test/Analysis/auto-obj-dtors-cfg-output.cpp
+++ b/test/Analysis/auto-obj-dtors-cfg-output.cpp
@@ -205,32 +205,35 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B0
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B4 (ENTRY)]
-// CHECK:    Succs (1): B3
+// CHECK:  [B5 (ENTRY)]
+// CHECK:    Succs (1): B4
 // CHECK:  [B1]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: [B1.2].~A() (Implicit destructor)
-// CHECK:    4: [B3.4].~A() (Implicit destructor)
-// CHECK:    5: [B3.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B3
+// CHECK:    4: [B4.4].~A() (Implicit destructor)
+// CHECK:    5: [B4.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B4
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
-// CHECK:    1: return;
-// CHECK:    2: [B3.4].~A() (Implicit destructor)
-// CHECK:    3: [B3.2].~A() (Implicit destructor)
+// CHECK:    1: [B4.4].~A() (Implicit destructor)
+// CHECK:    2: [B4.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B3
 // CHECK:    Succs (1): B0
 // CHECK:  [B3]
+// CHECK:    1: return;
+// CHECK:    Preds (1): B4
+// CHECK:    Succs (1): B2
+// CHECK:  [B4]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A a;
 // CHECK:    3:  (CXXConstructExpr, class A)
 // CHECK:    4: A b;
 // CHECK:    5: UV
-// CHECK:    6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B3.6]
-// CHECK:    Preds (1): B4
-// CHECK:    Succs (2): B2 B1
+// CHECK:    6: [B4.5] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B4.6]
+// CHECK:    Preds (1): B5
+// CHECK:    Succs (2): B3 B1
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (2): B1 B2
 // CHECK:  [B8 (ENTRY)]
@@ -323,78 +326,84 @@ void test_catch_copy() {
 // CHECK:    Succs (2): B3 B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B9 (ENTRY)]
-// CHECK:    Succs (1): B8
+// CHECK:  [B11 (ENTRY)]
+// CHECK:    Succs (1): B10
 // CHECK:  [B1]
-// CHECK:    1: [B8.6].~A() (Implicit destructor)
+// CHECK:    1: [B10.6].~A() (Implicit destructor)
 // CHECK:    2:  (CXXConstructExpr, class A)
 // CHECK:    3: A e;
 // CHECK:    4: [B1.3].~A() (Implicit destructor)
-// CHECK:    5: [B8.2].~A() (Implicit destructor)
-// CHECK:    Preds (2): B2 B5
+// CHECK:    5: [B10.2].~A() (Implicit destructor)
+// CHECK:    Preds (2): B2 B6
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A d;
 // CHECK:    3: [B2.2].~A() (Implicit destructor)
-// CHECK:    4: [B4.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B4
+// CHECK:    4: [B5.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B5
 // CHECK:    Succs (1): B1
 // CHECK:  [B3]
-// CHECK:    1: return;
-// CHECK:    2: [B4.2].~A() (Implicit destructor)
-// CHECK:    3: [B8.6].~A() (Implicit destructor)
-// CHECK:    4: [B8.2].~A() (Implicit destructor)
+// CHECK:    1: [B5.2].~A() (Implicit destructor)
+// CHECK:    2: [B10.6].~A() (Implicit destructor)
+// CHECK:    3: [B10.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B4
 // CHECK:    Succs (1): B0
 // CHECK:  [B4]
+// CHECK:    1: return;
+// CHECK:    Preds (1): B5
+// CHECK:    Succs (1): B3
+// CHECK:  [B5]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: UV
-// CHECK:    4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B4.4]
-// CHECK:    Preds (1): B8
-// CHECK:    Succs (2): B3 B2
-// CHECK:  [B5]
+// CHECK:    4: [B5.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B5.4]
+// CHECK:    Preds (1): B10
+// CHECK:    Succs (2): B4 B2
+// CHECK:  [B6]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A d;
-// CHECK:    3: [B5.2].~A() (Implicit destructor)
-// CHECK:    4: [B7.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B7
+// CHECK:    3: [B6.2].~A() (Implicit destructor)
+// CHECK:    4: [B9.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B9
 // CHECK:    Succs (1): B1
-// CHECK:  [B6]
-// CHECK:    1: return;
-// CHECK:    2: [B7.2].~A() (Implicit destructor)
-// CHECK:    3: [B8.6].~A() (Implicit destructor)
-// CHECK:    4: [B8.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B7
-// CHECK:    Succs (1): B0
 // CHECK:  [B7]
+// CHECK:    1: [B9.2].~A() (Implicit destructor)
+// CHECK:    2: [B10.6].~A() (Implicit destructor)
+// CHECK:    3: [B10.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B8
+// CHECK:    Succs (1): B0
+// CHECK:  [B8]
+// CHECK:    1: return;
+// CHECK:    Preds (1): B9
+// CHECK:    Succs (1): B7
+// CHECK:  [B9]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: UV
-// CHECK:    4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B7.4]
-// CHECK:    Preds (1): B8
-// CHECK:    Succs (2): B6 B5
-// CHECK:  [B8]
+// CHECK:    4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B9.4]
+// CHECK:    Preds (1): B10
+// CHECK:    Succs (2): B8 B6
+// CHECK:  [B10]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A a;
 // CHECK:    3: a
-// CHECK:    4: [B8.3] (ImplicitCastExpr, NoOp, const class A)
-// CHECK:    5: [B8.4] (CXXConstructExpr, class A)
+// CHECK:    4: [B10.3] (ImplicitCastExpr, NoOp, const class A)
+// CHECK:    5: [B10.4] (CXXConstructExpr, class A)
 // CHECK:    6: A b = a;
 // CHECK:    7: b
-// CHECK:    8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
-// CHECK:    9: [B8.8].operator int
-// CHECK:   10: [B8.9]()
-// CHECK:   11: [B8.10] (ImplicitCastExpr, UserDefinedConversion, int)
-// CHECK:   12: [B8.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK:    T: if [B8.12]
-// CHECK:    Preds (1): B9
-// CHECK:    Succs (2): B7 B4
+// CHECK:    8: [B10.7] (ImplicitCastExpr, NoOp, const class A)
+// CHECK:    9: [B10.8].operator int
+// CHECK:   10: [B10.9]()
+// CHECK:   11: [B10.10] (ImplicitCastExpr, UserDefinedConversion, int)
+// CHECK:   12: [B10.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
+// CHECK:    T: if [B10.12]
+// CHECK:    Preds (1): B11
+// CHECK:    Succs (2): B9 B5
 // CHECK:  [B0 (EXIT)]
-// CHECK:    Preds (3): B1 B3 B6
+// CHECK:    Preds (3): B1 B3 B7
 // CHECK:  [B6 (ENTRY)]
 // CHECK:    Succs (1): B5
 // CHECK:  [B1]
@@ -433,15 +442,15 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B12 (ENTRY)]
-// CHECK:    Succs (1): B11
+// CHECK:  [B13 (ENTRY)]
+// CHECK:    Succs (1): B12
 // CHECK:  [B1]
 // CHECK:    1: [B2.4].~A() (Implicit destructor)
 // CHECK:    2:  (CXXConstructExpr, class A)
 // CHECK:    3: A e;
 // CHECK:    4: [B1.3].~A() (Implicit destructor)
-// CHECK:    5: [B11.2].~A() (Implicit destructor)
-// CHECK:    Preds (2): B9 B2
+// CHECK:    5: [B12.2].~A() (Implicit destructor)
+// CHECK:    Preds (2): B10 B2
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
 // CHECK:    1: a
@@ -455,61 +464,64 @@ void test_catch_copy() {
 // CHECK:    9: [B2.8] (ImplicitCastExpr, UserDefinedConversion, int)
 // CHECK:   10: [B2.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
 // CHECK:    T: while [B2.10]
-// CHECK:    Preds (2): B3 B11
-// CHECK:    Succs (2): B10 B1
+// CHECK:    Preds (2): B3 B12
+// CHECK:    Succs (2): B11 B1
 // CHECK:  [B3]
-// CHECK:    Preds (2): B4 B7
+// CHECK:    Preds (2): B4 B8
 // CHECK:    Succs (1): B2
 // CHECK:  [B4]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A d;
 // CHECK:    3: [B4.2].~A() (Implicit destructor)
-// CHECK:    4: [B10.2].~A() (Implicit destructor)
+// CHECK:    4: [B11.2].~A() (Implicit destructor)
 // CHECK:    5: [B2.4].~A() (Implicit destructor)
-// CHECK:    Preds (1): B6
+// CHECK:    Preds (1): B7
 // CHECK:    Succs (1): B3
 // CHECK:  [B5]
-// CHECK:    1: return;
-// CHECK:    2: [B10.2].~A() (Implicit destructor)
-// CHECK:    3: [B2.4].~A() (Implicit destructor)
-// CHECK:    4: [B11.2].~A() (Implicit destructor)
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
+// CHECK:    2: [B2.4].~A() (Implicit destructor)
+// CHECK:    3: [B12.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B6
 // CHECK:    Succs (1): B0
 // CHECK:  [B6]
-// CHECK:    1: UV
-// CHECK:    2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B6.2]
-// CHECK:    Preds (1): B8
-// CHECK:    Succs (2): B5 B4
+// CHECK:    1: return;
+// CHECK:    Preds (1): B7
+// CHECK:    Succs (1): B5
 // CHECK:  [B7]
-// CHECK:    1: [B10.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B7.2]
+// CHECK:    Preds (1): B9
+// CHECK:    Succs (2): B6 B4
+// CHECK:  [B8]
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
 // CHECK:    2: [B2.4].~A() (Implicit destructor)
 // CHECK:    T: continue;
-// CHECK:    Preds (1): B8
+// CHECK:    Preds (1): B9
 // CHECK:    Succs (1): B3
-// CHECK:  [B8]
-// CHECK:    1: UV
-// CHECK:    2: [B8.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B8.2]
-// CHECK:    Preds (1): B10
-// CHECK:    Succs (2): B7 B6
 // CHECK:  [B9]
-// CHECK:    1: [B10.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B9.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B9.2]
+// CHECK:    Preds (1): B11
+// CHECK:    Succs (2): B8 B7
+// CHECK:  [B10]
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
 // CHECK:    T: break;
-// CHECK:    Preds (1): B10
+// CHECK:    Preds (1): B11
 // CHECK:    Succs (1): B1
-// CHECK:  [B10]
+// CHECK:  [B11]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: UV
-// CHECK:    4: [B10.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B10.4]
+// CHECK:    4: [B11.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B11.4]
 // CHECK:    Preds (1): B2
-// CHECK:    Succs (2): B9 B8
-// CHECK:  [B11]
+// CHECK:    Succs (2): B10 B9
+// CHECK:  [B12]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A a;
-// CHECK:    Preds (1): B12
+// CHECK:    Preds (1): B13
 // CHECK:    Succs (1): B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (2): B1 B5
@@ -532,72 +544,75 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B12 (ENTRY)]
-// CHECK:    Succs (1): B11
+// CHECK:  [B13 (ENTRY)]
+// CHECK:    Succs (1): B12
 // CHECK:  [B1]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A d;
 // CHECK:    3: [B1.2].~A() (Implicit destructor)
-// CHECK:    4: [B11.2].~A() (Implicit destructor)
-// CHECK:    Preds (2): B8 B2
+// CHECK:    4: [B12.2].~A() (Implicit destructor)
+// CHECK:    Preds (2): B9 B2
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
 // CHECK:    1: UV
 // CHECK:    2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
 // CHECK:    T: do ... while [B2.2]
-// CHECK:    Preds (2): B3 B6
-// CHECK:    Succs (2): B10 B1
+// CHECK:    Preds (2): B3 B7
+// CHECK:    Succs (2): B11 B1
 // CHECK:  [B3]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: [B3.2].~A() (Implicit destructor)
-// CHECK:    4: [B9.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B5
+// CHECK:    4: [B10.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B6
 // CHECK:    Succs (1): B2
 // CHECK:  [B4]
-// CHECK:    1: return;
-// CHECK:    2: [B9.2].~A() (Implicit destructor)
-// CHECK:    3: [B11.2].~A() (Implicit destructor)
+// CHECK:    1: [B10.2].~A() (Implicit destructor)
+// CHECK:    2: [B12.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B5
 // CHECK:    Succs (1): B0
 // CHECK:  [B5]
-// CHECK:    1: UV
-// CHECK:    2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B5.2]
-// CHECK:    Preds (1): B7
-// CHECK:    Succs (2): B4 B3
+// CHECK:    1: return;
+// CHECK:    Preds (1): B6
+// CHECK:    Succs (1): B4
 // CHECK:  [B6]
-// CHECK:    1: [B9.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B6.2]
+// CHECK:    Preds (1): B8
+// CHECK:    Succs (2): B5 B3
+// CHECK:  [B7]
+// CHECK:    1: [B10.2].~A() (Implicit destructor)
 // CHECK:    T: continue;
-// CHECK:    Preds (1): B7
+// CHECK:    Preds (1): B8
 // CHECK:    Succs (1): B2
-// CHECK:  [B7]
-// CHECK:    1: UV
-// CHECK:    2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B7.2]
-// CHECK:    Preds (1): B9
-// CHECK:    Succs (2): B6 B5
 // CHECK:  [B8]
-// CHECK:    1: [B9.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B8.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B8.2]
+// CHECK:    Preds (1): B10
+// CHECK:    Succs (2): B7 B6
+// CHECK:  [B9]
+// CHECK:    1: [B10.2].~A() (Implicit destructor)
 // CHECK:    T: break;
-// CHECK:    Preds (1): B9
+// CHECK:    Preds (1): B10
 // CHECK:    Succs (1): B1
-// CHECK:  [B9]
+// CHECK:  [B10]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A b;
 // CHECK:    3: UV
-// CHECK:    4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B9.4]
-// CHECK:    Preds (2): B10 B11
-// CHECK:    Succs (2): B8 B7
-// CHECK:  [B10]
-// CHECK:    Preds (1): B2
-// CHECK:    Succs (1): B9
+// CHECK:    4: [B10.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B10.4]
+// CHECK:    Preds (2): B11 B12
+// CHECK:    Succs (2): B9 B8
 // CHECK:  [B11]
+// CHECK:    Preds (1): B2
+// CHECK:    Succs (1): B10
+// CHECK:  [B12]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A a;
-// CHECK:    Preds (1): B12
-// CHECK:    Succs (1): B9
+// CHECK:    Preds (1): B13
+// CHECK:    Succs (1): B10
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (2): B1 B4
 // CHECK:  [B4 (ENTRY)]
@@ -629,7 +644,7 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B1
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B9 (ENTRY)]
+// CHECK:  [B10 (ENTRY)]
 // CHECK:    Succs (1): B2
 // CHECK:  [B1]
 // CHECK:    1: [B2.6].~A() (Implicit destructor)
@@ -637,7 +652,7 @@ void test_catch_copy() {
 // CHECK:    3: A g;
 // CHECK:    4: [B1.3].~A() (Implicit destructor)
 // CHECK:    5: [B2.2].~A() (Implicit destructor)
-// CHECK:    Preds (3): B3 B7 B2
+// CHECK:    Preds (3): B3 B8 B2
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
 // CHECK:    1:  (CXXConstructExpr, class A)
@@ -652,8 +667,8 @@ void test_catch_copy() {
 // CHECK:   10: [B2.9]()
 // CHECK:   11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
 // CHECK:    T: switch [B2.11]
-// CHECK:    Preds (1): B9
-// CHECK:    Succs (3): B3 B8
+// CHECK:    Preds (1): B10
+// CHECK:    Succs (3): B3 B9
 // CHECK:      B1
 // CHECK:  [B3]
 // CHECK:   case 1:
@@ -664,36 +679,39 @@ void test_catch_copy() {
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A f;
 // CHECK:    3: [B4.2].~A() (Implicit destructor)
-// CHECK:    4: [B8.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B6
+// CHECK:    4: [B9.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B7
 // CHECK:    Succs (1): B3
 // CHECK:  [B5]
-// CHECK:    1: return;
-// CHECK:    2: [B8.2].~A() (Implicit destructor)
-// CHECK:    3: [B2.6].~A() (Implicit destructor)
-// CHECK:    4: [B2.2].~A() (Implicit destructor)
+// CHECK:    1: [B9.2].~A() (Implicit destructor)
+// CHECK:    2: [B2.6].~A() (Implicit destructor)
+// CHECK:    3: [B2.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B6
 // CHECK:    Succs (1): B0
 // CHECK:  [B6]
-// CHECK:    1: UV
-// CHECK:    2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B6.2]
-// CHECK:    Preds (1): B8
-// CHECK:    Succs (2): B5 B4
+// CHECK:    1: return;
+// CHECK:    Preds (1): B7
+// CHECK:    Succs (1): B5
 // CHECK:  [B7]
-// CHECK:    1: [B8.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B7.2]
+// CHECK:    Preds (1): B9
+// CHECK:    Succs (2): B6 B4
+// CHECK:  [B8]
+// CHECK:    1: [B9.2].~A() (Implicit destructor)
 // CHECK:    T: break;
-// CHECK:    Preds (1): B8
+// CHECK:    Preds (1): B9
 // CHECK:    Succs (1): B1
-// CHECK:  [B8]
+// CHECK:  [B9]
 // CHECK:   case 0:
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A c;
 // CHECK:    3: UV
-// CHECK:    4: [B8.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B8.4]
+// CHECK:    4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B9.4]
 // CHECK:    Preds (1): B2
-// CHECK:    Succs (2): B7 B6
+// CHECK:    Succs (2): B8 B7
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (2): B1 B5
 // CHECK:  [B6 (ENTRY)]
@@ -734,16 +752,16 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (1): B1
-// CHECK:  [B12 (ENTRY)]
-// CHECK:    Succs (1): B11
+// CHECK:  [B13 (ENTRY)]
+// CHECK:    Succs (1): B12
 // CHECK:  [B1]
 // CHECK:    1: [B2.4].~A() (Implicit destructor)
-// CHECK:    2: [B11.4].~A() (Implicit destructor)
+// CHECK:    2: [B12.4].~A() (Implicit destructor)
 // CHECK:    3:  (CXXConstructExpr, class A)
 // CHECK:    4: A f;
 // CHECK:    5: [B1.4].~A() (Implicit destructor)
-// CHECK:    6: [B11.2].~A() (Implicit destructor)
-// CHECK:    Preds (2): B9 B2
+// CHECK:    6: [B12.2].~A() (Implicit destructor)
+// CHECK:    Preds (2): B10 B2
 // CHECK:    Succs (1): B0
 // CHECK:  [B2]
 // CHECK:    1: b
@@ -757,63 +775,66 @@ void test_catch_copy() {
 // CHECK:    9: [B2.8] (ImplicitCastExpr, UserDefinedConversion, int)
 // CHECK:   10: [B2.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
 // CHECK:    T: for (...; [B2.10]; )
-// CHECK:    Preds (2): B3 B11
-// CHECK:    Succs (2): B10 B1
+// CHECK:    Preds (2): B3 B12
+// CHECK:    Succs (2): B11 B1
 // CHECK:  [B3]
 // CHECK:    1: [B2.4].~A() (Implicit destructor)
-// CHECK:    Preds (2): B4 B7
+// CHECK:    Preds (2): B4 B8
 // CHECK:    Succs (1): B2
 // CHECK:  [B4]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A e;
 // CHECK:    3: [B4.2].~A() (Implicit destructor)
-// CHECK:    4: [B10.2].~A() (Implicit destructor)
-// CHECK:    Preds (1): B6
+// CHECK:    4: [B11.2].~A() (Implicit destructor)
+// CHECK:    Preds (1): B7
 // CHECK:    Succs (1): B3
 // CHECK:  [B5]
-// CHECK:    1: return;
-// CHECK:    2: [B10.2].~A() (Implicit destructor)
-// CHECK:    3: [B2.4].~A() (Implicit destructor)
-// CHECK:    4: [B11.4].~A() (Implicit destructor)
-// CHECK:    5: [B11.2].~A() (Implicit destructor)
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
+// CHECK:    2: [B2.4].~A() (Implicit destructor)
+// CHECK:    3: [B12.4].~A() (Implicit destructor)
+// CHECK:    4: [B12.2].~A() (Implicit destructor)
 // CHECK:    Preds (1): B6
 // CHECK:    Succs (1): B0
 // CHECK:  [B6]
-// CHECK:    1: UV
-// CHECK:    2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B6.2]
-// CHECK:    Preds (1): B8
-// CHECK:    Succs (2): B5 B4
+// CHECK:    1: return;
+// CHECK:    Preds (1): B7
+// CHECK:    Succs (1): B5
 // CHECK:  [B7]
-// CHECK:    1: [B10.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B7.2]
+// CHECK:    Preds (1): B9
+// CHECK:    Succs (2): B6 B4
+// CHECK:  [B8]
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
 // CHECK:    T: continue;
-// CHECK:    Preds (1): B8
+// CHECK:    Preds (1): B9
 // CHECK:    Succs (1): B3
-// CHECK:  [B8]
-// CHECK:    1: UV
-// CHECK:    2: [B8.1] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B8.2]
-// CHECK:    Preds (1): B10
-// CHECK:    Succs (2): B7 B6
 // CHECK:  [B9]
-// CHECK:    1: [B10.2].~A() (Implicit destructor)
+// CHECK:    1: UV
+// CHECK:    2: [B9.1] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B9.2]
+// CHECK:    Preds (1): B11
+// CHECK:    Succs (2): B8 B7
+// CHECK:  [B10]
+// CHECK:    1: [B11.2].~A() (Implicit destructor)
 // CHECK:    T: break;
-// CHECK:    Preds (1): B10
+// CHECK:    Preds (1): B11
 // CHECK:    Succs (1): B1
-// CHECK:  [B10]
+// CHECK:  [B11]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A d;
 // CHECK:    3: UV
-// CHECK:    4: [B10.3] (ImplicitCastExpr, LValueToRValue, _Bool)
-// CHECK:    T: if [B10.4]
+// CHECK:    4: [B11.3] (ImplicitCastExpr, LValueToRValue, _Bool)
+// CHECK:    T: if [B11.4]
 // CHECK:    Preds (1): B2
-// CHECK:    Succs (2): B9 B8
-// CHECK:  [B11]
+// CHECK:    Succs (2): B10 B9
+// CHECK:  [B12]
 // CHECK:    1:  (CXXConstructExpr, class A)
 // CHECK:    2: A a;
 // CHECK:    3:  (CXXConstructExpr, class A)
 // CHECK:    4: A b;
-// CHECK:    Preds (1): B12
+// CHECK:    Preds (1): B13
 // CHECK:    Succs (1): B2
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (2): B1 B5
@@ -840,5 +861,3 @@ void test_catch_copy() {
 // CHECK:    Succs (1): B0
 // CHECK:  [B0 (EXIT)]
 // CHECK:    Preds (3): B2 B1 B3
-
-
-- 
1.7.5.4

