Change subexpressions to be visited in the CFG from left-to-right.

This is a more natural order of evaluation, and it is very important
for visualization in the static analyzer.  Within Xcode, the arrows
will not jump from right to left, which looks very visually jarring.
It also provides a more natural location for dataflow-based diagnostics.

Along the way, we found a case in the analyzer diagnostics where we
needed to indicate that a variable was "captured" by a block.

-fsyntax-only timings on sqlite3.c show no visible performance change,
although this is just one test case.

Fixes <rdar://problem/13016513>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174447 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/temp-obj-dtors-cfg-output.cpp b/test/Analysis/temp-obj-dtors-cfg-output.cpp
index c884475..1ddccb7 100644
--- a/test/Analysis/temp-obj-dtors-cfg-output.cpp
+++ b/test/Analysis/temp-obj-dtors-cfg-output.cpp
@@ -207,22 +207,22 @@
 // CHECK:    14: int a = int(A().operator int()) + int(B().operator int());
 // CHECK:    15: ~B() (Temporary object destructor)
 // CHECK:    16: ~A() (Temporary object destructor)
-// CHECK:    17: A() (CXXConstructExpr, class A)
-// CHECK:    18: [B1.17] (BindTemporary)
-// CHECK:    19: [B1.18].operator int
-// CHECK:    20: [B1.19]()
-// CHECK:    21: [B1.20] (ImplicitCastExpr, UserDefinedConversion, int)
-// CHECK:    22: int([B1.21]) (CXXFunctionalCastExpr, NoOp, int)
-// CHECK:    23: B() (CXXConstructExpr, class B)
-// CHECK:    24: [B1.23] (BindTemporary)
-// CHECK:    25: [B1.24].operator int
-// CHECK:    26: [B1.25]()
-// CHECK:    27: [B1.26] (ImplicitCastExpr, UserDefinedConversion, int)
-// CHECK:    28: int([B1.27]) (CXXFunctionalCastExpr, NoOp, int)
-// CHECK:    29: [B1.22] + [B1.28]
-// CHECK:    30: foo
-// CHECK:    31: [B1.30] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
-// CHECK:    32: [B1.31]([B1.29])
+// CHECK:    17: foo
+// CHECK:    18: [B1.17] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
+// CHECK:    19: A() (CXXConstructExpr, class A)
+// CHECK:    20: [B1.19] (BindTemporary)
+// CHECK:    21: [B1.20].operator int
+// CHECK:    22: [B1.21]()
+// CHECK:    23: [B1.22] (ImplicitCastExpr, UserDefinedConversion, int)
+// CHECK:    24: int([B1.23]) (CXXFunctionalCastExpr, NoOp, int)
+// CHECK:    25: B() (CXXConstructExpr, class B)
+// CHECK:    26: [B1.25] (BindTemporary)
+// CHECK:    27: [B1.26].operator int
+// CHECK:    28: [B1.27]()
+// CHECK:    29: [B1.28] (ImplicitCastExpr, UserDefinedConversion, int)
+// CHECK:    30: int([B1.29]) (CXXFunctionalCastExpr, NoOp, int)
+// CHECK:    31: [B1.24] + [B1.30]
+// CHECK:    32: [B1.18]([B1.31])
 // CHECK:    33: ~B() (Temporary object destructor)
 // CHECK:    34: ~A() (Temporary object destructor)
 // CHECK:    35: int b;
@@ -242,11 +242,9 @@
 // CHECK:     Preds (1): B3
 // CHECK:     Succs (1): B1
 // CHECK:   [B3]
-// CHECK:     1: [B5.6] && [B4.5]
-// CHECK:     2: foo
-// CHECK:     3: [B3.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool))
-// CHECK:     4: [B3.3]([B3.1])
-// CHECK:     T: [B5.6] && ...
+// CHECK:     1: [B5.8] && [B4.5]
+// CHECK:     2: [B5.3]([B3.1])
+// CHECK:     T: [B5.8] && ...
 // CHECK:     Preds (2): B4 B5
 // CHECK:     Succs (2): B2 B1
 // CHECK:   [B4]
@@ -259,12 +257,14 @@
 // CHECK:     Succs (1): B3
 // CHECK:   [B5]
 // CHECK:     1: ~A() (Temporary object destructor)
-// CHECK:     2: A() (CXXConstructExpr, class A)
-// CHECK:     3: [B5.2] (BindTemporary)
-// CHECK:     4: [B5.3].operator _Bool
-// CHECK:     5: [B5.4]()
-// CHECK:     6: [B5.5] (ImplicitCastExpr, UserDefinedConversion, _Bool)
-// CHECK:     T: [B5.6] && ...
+// CHECK:     2: foo
+// CHECK:     3: [B5.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool))
+// CHECK:     4: A() (CXXConstructExpr, class A)
+// CHECK:     5: [B5.4] (BindTemporary)
+// CHECK:     6: [B5.5].operator _Bool
+// CHECK:     7: [B5.6]()
+// CHECK:     8: [B5.7] (ImplicitCastExpr, UserDefinedConversion, _Bool)
+// CHECK:     T: [B5.8] && ...
 // CHECK:     Preds (2): B6 B7
 // CHECK:     Succs (2): B4 B3
 // CHECK:   [B6]
@@ -308,11 +308,9 @@
 // CHECK:     Preds (1): B3
 // CHECK:     Succs (1): B1
 // CHECK:   [B3]
-// CHECK:     1: [B5.6] || [B4.5]
-// CHECK:     2: foo
-// CHECK:     3: [B3.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool))
-// CHECK:     4: [B3.3]([B3.1])
-// CHECK:     T: [B5.6] || ...
+// CHECK:     1: [B5.8] || [B4.5]
+// CHECK:     2: [B5.3]([B3.1])
+// CHECK:     T: [B5.8] || ...
 // CHECK:     Preds (2): B4 B5
 // CHECK:     Succs (2): B1 B2
 // CHECK:   [B4]
@@ -325,12 +323,14 @@
 // CHECK:     Succs (1): B3
 // CHECK:   [B5]
 // CHECK:     1: ~A() (Temporary object destructor)
-// CHECK:     2: A() (CXXConstructExpr, class A)
-// CHECK:     3: [B5.2] (BindTemporary)
-// CHECK:     4: [B5.3].operator _Bool
-// CHECK:     5: [B5.4]()
-// CHECK:     6: [B5.5] (ImplicitCastExpr, UserDefinedConversion, _Bool)
-// CHECK:     T: [B5.6] || ...
+// CHECK:     2: foo
+// CHECK:     3: [B5.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool))
+// CHECK:     4: A() (CXXConstructExpr, class A)
+// CHECK:     5: [B5.4] (BindTemporary)
+// CHECK:     6: [B5.5].operator _Bool
+// CHECK:     7: [B5.6]()
+// CHECK:     8: [B5.7] (ImplicitCastExpr, UserDefinedConversion, _Bool)
+// CHECK:     T: [B5.8] || ...
 // CHECK:     Preds (2): B6 B7
 // CHECK:     Succs (2): B3 B4
 // CHECK:   [B6]
@@ -370,17 +370,17 @@
 // CHECK:     Preds (2): B2 B3
 // CHECK:     Succs (1): B0
 // CHECK:   [B2]
-// CHECK:     1: 0
-// CHECK:     2: foo
-// CHECK:     3: [B2.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
-// CHECK:     4: [B2.3]([B2.1])
+// CHECK:     1: foo
+// CHECK:     2: [B2.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
+// CHECK:     3: 0
+// CHECK:     4: [B2.2]([B2.3])
 // CHECK:     Preds (1): B4
 // CHECK:     Succs (1): B1
 // CHECK:   [B3]
-// CHECK:     1: 0
-// CHECK:     2: foo
-// CHECK:     3: [B3.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
-// CHECK:     4: [B3.3]([B3.1])
+// CHECK:     1: foo
+// CHECK:     2: [B3.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int))
+// CHECK:     3: 0
+// CHECK:     4: [B3.2]([B3.3])
 // CHECK:     Preds (1): B4
 // CHECK:     Succs (1): B1
 // CHECK:   [B4]
@@ -474,13 +474,11 @@
 // CHECK:     Preds (1): B4
 // CHECK:     Succs (1): B1
 // CHECK:   [B4]
-// CHECK:     1: [B7.6] ? [B5.6] : [B6.15]
+// CHECK:     1: [B7.8] ? [B5.6] : [B6.15]
 // CHECK:     2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
 // CHECK:     3: [B4.2]
-// CHECK:     4: foo
-// CHECK:     5: [B4.4] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
-// CHECK:     6: [B4.5]([B4.3])
-// CHECK:     T: [B7.6] ? ... : ...
+// CHECK:     4: [B7.3]([B4.3])
+// CHECK:     T: [B7.8] ? ... : ...
 // CHECK:     Preds (2): B5 B6
 // CHECK:     Succs (2): B2 B3
 // CHECK:   [B5]
@@ -512,12 +510,14 @@
 // CHECK:     Succs (1): B4
 // CHECK:   [B7]
 // CHECK:     1: ~B() (Temporary object destructor)
-// CHECK:     2: B() (CXXConstructExpr, class B)
-// CHECK:     3: [B7.2] (BindTemporary)
-// CHECK:     4: [B7.3].operator _Bool
-// CHECK:     5: [B7.4]()
-// CHECK:     6: [B7.5] (ImplicitCastExpr, UserDefinedConversion, _Bool)
-// CHECK:     T: [B7.6] ? ... : ...
+// CHECK:     2: foo
+// CHECK:     3: [B7.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
+// CHECK:     4: B() (CXXConstructExpr, class B)
+// CHECK:     5: [B7.4] (BindTemporary)
+// CHECK:     6: [B7.5].operator _Bool
+// CHECK:     7: [B7.6]()
+// CHECK:     8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool)
+// CHECK:     T: [B7.8] ? ... : ...
 // CHECK:     Preds (2): B8 B9
 // CHECK:     Succs (2): B5 B6
 // CHECK:   [B8]
@@ -647,17 +647,15 @@
 // CHECK:     Preds (1): B4
 // CHECK:     Succs (1): B1
 // CHECK:   [B4]
-// CHECK:     1: [B7.3] ?: [B6.6]
+// CHECK:     1: [B7.5] ?: [B6.6]
 // CHECK:     2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
 // CHECK:     3: [B4.2]
-// CHECK:     4: foo
-// CHECK:     5: [B4.4] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
-// CHECK:     6: [B4.5]([B4.3])
-// CHECK:     T: [B7.6] ? ... : ...
+// CHECK:     4: [B7.3]([B4.3])
+// CHECK:     T: [B7.8] ? ... : ...
 // CHECK:     Preds (2): B5 B6
 // CHECK:     Succs (2): B2 B3
 // CHECK:   [B5]
-// CHECK:     1: [B7.3] (ImplicitCastExpr, NoOp, const class A)
+// CHECK:     1: [B7.5] (ImplicitCastExpr, NoOp, const class A)
 // CHECK:     2: [B5.1]
 // CHECK:     3: [B5.2] (CXXConstructExpr, class A)
 // CHECK:     4: [B5.3] (BindTemporary)
@@ -674,12 +672,14 @@
 // CHECK:     Succs (1): B4
 // CHECK:   [B7]
 // CHECK:     1: ~A() (Temporary object destructor)
-// CHECK:     2: A() (CXXConstructExpr, class A)
-// CHECK:     3: [B7.2] (BindTemporary)
-// CHECK:     4: [B7.3].operator _Bool
-// CHECK:     5: [B7.4]()
-// CHECK:     6: [B7.5] (ImplicitCastExpr, UserDefinedConversion, _Bool)
-// CHECK:     T: [B7.6] ? ... : ...
+// CHECK:     2: foo
+// CHECK:     3: [B7.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
+// CHECK:     4: A() (CXXConstructExpr, class A)
+// CHECK:     5: [B7.4] (BindTemporary)
+// CHECK:     6: [B7.5].operator _Bool
+// CHECK:     7: [B7.6]()
+// CHECK:     8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool)
+// CHECK:     T: [B7.8] ? ... : ...
 // CHECK:     Preds (2): B9 B8
 // CHECK:     Succs (2): B5 B6
 // CHECK:   [B8]
@@ -745,13 +745,13 @@
 // CHECK:     3: [B1.2] (ImplicitCastExpr, NoOp, const class A)
 // CHECK:     4: [B1.3]
 // CHECK:     5: const A &a = A();
-// CHECK:     6: A() (CXXConstructExpr, class A)
-// CHECK:     7: [B1.6] (BindTemporary)
-// CHECK:     8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
-// CHECK:     9: [B1.8]
-// CHECK:    10: foo
-// CHECK:    11: [B1.10] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
-// CHECK:    12: [B1.11]([B1.9])
+// CHECK:     6: foo
+// CHECK:     7: [B1.6] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
+// CHECK:     8: A() (CXXConstructExpr, class A)
+// CHECK:     9: [B1.8] (BindTemporary)
+// CHECK:    10: [B1.9] (ImplicitCastExpr, NoOp, const class A)
+// CHECK:    11: [B1.10]
+// CHECK:    12: [B1.7]([B1.11])
 // CHECK:    13: ~A() (Temporary object destructor)
 // CHECK:    14: int b;
 // CHECK:    15: [B1.5].~A() (Implicit destructor)
@@ -787,15 +787,15 @@
 // CHECK:     5: [B1.4] (ImplicitCastExpr, NoOp, const class A)
 // CHECK:     6: [B1.5]
 // CHECK:     7: const A &a = A::make();
-// CHECK:     8: A::make
-// CHECK:     9: [B1.8] (ImplicitCastExpr, FunctionToPointerDecay, class A (*)(void))
-// CHECK:    10: [B1.9]()
-// CHECK:    11: [B1.10] (BindTemporary)
-// CHECK:    12: [B1.11] (ImplicitCastExpr, NoOp, const class A)
-// CHECK:    13: [B1.12]
-// CHECK:    14: foo
-// CHECK:    15: [B1.14] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
-// CHECK:    16: [B1.15]([B1.13])
+// CHECK:     8: foo
+// CHECK:     9: [B1.8] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &))
+// CHECK:    10: A::make
+// CHECK:    11: [B1.10] (ImplicitCastExpr, FunctionToPointerDecay, class A (*)(void))
+// CHECK:    12: [B1.11]()
+// CHECK:    13: [B1.12] (BindTemporary)
+// CHECK:    14: [B1.13] (ImplicitCastExpr, NoOp, const class A)
+// CHECK:    15: [B1.14]
+// CHECK:    16: [B1.9]([B1.15])
 // CHECK:    17: ~A() (Temporary object destructor)
 // CHECK:    18: int b;
 // CHECK:    19: [B1.7].~A() (Implicit destructor)