diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/temp-obj-dtors-cfg-output.cpp | 535 | ||||
-rw-r--r-- | clang/test/Analysis/temporaries.cpp | 173 |
2 files changed, 275 insertions, 433 deletions
diff --git a/clang/test/Analysis/temp-obj-dtors-cfg-output.cpp b/clang/test/Analysis/temp-obj-dtors-cfg-output.cpp index 92d185eaf4b..5fb33d36b85 100644 --- a/clang/test/Analysis/temp-obj-dtors-cfg-output.cpp +++ b/clang/test/Analysis/temp-obj-dtors-cfg-output.cpp @@ -324,7 +324,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: [B3] // CHECK: 1: [B5.8] && [B4.5] // CHECK: 2: [B5.3]([B3.1]) -// CHECK: T: (Temp Dtor) [B4.2] +// CHECK: T: (Temp Dtor) [B5.8] && ... // CHECK: Preds (2): B4 B5 // CHECK: Succs (2): B2 B1 // CHECK: [B4] @@ -354,7 +354,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: [B7] // CHECK: 1: [B9.5] && [B8.5] // CHECK: 2: bool a = A() && B(); -// CHECK: T: (Temp Dtor) [B8.2] +// CHECK: T: (Temp Dtor) [B9.5] && ... // CHECK: Preds (2): B8 B9 // CHECK: Succs (2): B6 B5 // CHECK: [B8] @@ -390,9 +390,9 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: [B3] // CHECK: 1: [B5.8] || [B4.5] // CHECK: 2: [B5.3]([B3.1]) -// CHECK: T: (Temp Dtor) [B4.2] +// CHECK: T: (Temp Dtor) [B5.8] || ... // CHECK: Preds (2): B4 B5 -// CHECK: Succs (2): B2 B1 +// CHECK: Succs (2): B1 B2 // CHECK: [B4] // CHECK: 1: B() (CXXConstructExpr, class B) // CHECK: 2: [B4.1] (BindTemporary) @@ -420,9 +420,9 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: [B7] // CHECK: 1: [B9.5] || [B8.5] // CHECK: 2: bool a = A() || B(); -// CHECK: T: (Temp Dtor) [B8.2] +// CHECK: T: (Temp Dtor) [B9.5] || ... // CHECK: Preds (2): B8 B9 -// CHECK: Succs (2): B6 B5 +// CHECK: Succs (2): B5 B6 // CHECK: [B8] // CHECK: 1: B() (CXXConstructExpr, class B) // CHECK: 2: [B8.1] (BindTemporary) @@ -442,11 +442,11 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B7 B8 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 -// CHECK: [B12 (ENTRY)] -// CHECK: Succs (1): B11 +// CHECK: [B11 (ENTRY)] +// CHECK: Succs (1): B10 // CHECK: [B1] // CHECK: 1: int b; -// CHECK: 2: [B8.5].~A() (Implicit destructor) +// CHECK: 2: [B7.5].~A() (Implicit destructor) // CHECK: Preds (2): B2 B3 // CHECK: Succs (1): B0 // CHECK: [B2] @@ -477,66 +477,63 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: [B5] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Preds (1): B6 +// CHECK: Preds (1): B7 // CHECK: Succs (1): B4 // CHECK: [B6] -// CHECK: T: (Temp Dtor) [B9.2] -// CHECK: Preds (2): B7 B8 -// CHECK: Succs (2): B5 B4 -// CHECK: [B7] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) // CHECK: 3: ~A() (Temporary object destructor) // CHECK: 4: ~B() (Temporary object destructor) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B6 -// CHECK: [B8] -// CHECK: 1: [B11.5] ? [B9.6] : [B10.15] -// CHECK: 2: [B8.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B8.2] -// CHECK: 4: [B8.3] (CXXConstructExpr, class A) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 +// CHECK: [B7] +// CHECK: 1: [B10.5] ? [B8.6] : [B9.15] +// CHECK: 2: [B7.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B7.2] +// CHECK: 4: [B7.3] (CXXConstructExpr, class A) // CHECK: 5: A a = B() ? A() : A(B()); -// CHECK: T: (Temp Dtor) [B10.2] -// CHECK: Preds (2): B9 B10 -// CHECK: Succs (2): B7 B6 -// CHECK: [B9] +// CHECK: T: (Temp Dtor) [B10.5] ? ... : ... +// CHECK: Preds (2): B8 B9 +// CHECK: Succs (2): B5 B6 +// CHECK: [B8] // CHECK: 1: A() (CXXConstructExpr, class A) +// CHECK: 2: [B8.1] (BindTemporary) +// CHECK: 3: [B8.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B8.3] +// CHECK: 5: [B8.4] (CXXConstructExpr, class A) +// CHECK: 6: [B8.5] (BindTemporary) +// CHECK: Preds (1): B10 +// CHECK: Succs (1): B7 +// CHECK: [B9] +// CHECK: 1: B() (CXXConstructExpr, class B) // CHECK: 2: [B9.1] (BindTemporary) -// CHECK: 3: [B9.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B9.3] -// CHECK: 5: [B9.4] (CXXConstructExpr, class A) +// CHECK: 3: [B9.2].operator A +// CHECK: 4: [B9.2] +// CHECK: 5: [B9.4] (ImplicitCastExpr, UserDefinedConversion, class A) // CHECK: 6: [B9.5] (BindTemporary) -// CHECK: Preds (1): B11 -// CHECK: Succs (1): B8 +// CHECK: 7: [B9.6] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 8: [B9.7] +// CHECK: 9: [B9.8] (CXXConstructExpr, class A) +// CHECK: 10: [B9.9] (BindTemporary) +// CHECK: 11: A([B9.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) +// CHECK: 12: [B9.11] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 13: [B9.12] +// CHECK: 14: [B9.13] (CXXConstructExpr, class A) +// CHECK: 15: [B9.14] (BindTemporary) +// CHECK: Preds (1): B10 +// CHECK: Succs (1): B7 // CHECK: [B10] // CHECK: 1: B() (CXXConstructExpr, class B) // CHECK: 2: [B10.1] (BindTemporary) -// CHECK: 3: [B10.2].operator A +// CHECK: 3: [B10.2].operator bool // CHECK: 4: [B10.2] -// CHECK: 5: [B10.4] (ImplicitCastExpr, UserDefinedConversion, class A) -// CHECK: 6: [B10.5] (BindTemporary) -// CHECK: 7: [B10.6] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 8: [B10.7] -// CHECK: 9: [B10.8] (CXXConstructExpr, class A) -// CHECK: 10: [B10.9] (BindTemporary) -// CHECK: 11: A([B10.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) -// CHECK: 12: [B10.11] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 13: [B10.12] -// CHECK: 14: [B10.13] (CXXConstructExpr, class A) -// CHECK: 15: [B10.14] (BindTemporary) +// CHECK: 5: [B10.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B10.5] ? ... : ... // CHECK: Preds (1): B11 -// CHECK: Succs (1): B8 -// CHECK: [B11] -// CHECK: 1: B() (CXXConstructExpr, class B) -// CHECK: 2: [B11.1] (BindTemporary) -// CHECK: 3: [B11.2].operator bool -// CHECK: 4: [B11.2] -// CHECK: 5: [B11.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B11.5] ? ... : ... -// CHECK: Preds (1): B12 -// CHECK: Succs (2): B9 B10 +// CHECK: Succs (2): B8 B9 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: C() : b_(true) // CHECK: [B2 (ENTRY)] // CHECK: Succs (1): B1 // CHECK: [B1] @@ -546,10 +543,12 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: ~C() // CHECK: [B1 (ENTRY)] // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: operator bool() // CHECK: [B2 (ENTRY)] // CHECK: Succs (1): B1 // CHECK: [B1] @@ -561,6 +560,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: D() : b_(true) // CHECK: [B2 (ENTRY)] // CHECK: Succs (1): B1 // CHECK: [B1] @@ -570,6 +570,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: operator bool() // CHECK: [B2 (ENTRY)] // CHECK: Succs (1): B1 // CHECK: [B1] @@ -581,6 +582,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 +// CHECK: int test_cond_unnamed_custom_destructor() // CHECK: [B4 (ENTRY)] // CHECK: Succs (1): B3 // CHECK: [B1] @@ -605,6 +607,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B2 B1 // CHECK: [B0 (EXIT)] // CHECK: Preds (2): B1 B2 +// CHECK: int test_cond_named_custom_destructor() // CHECK: [B5 (ENTRY)] // CHECK: Succs (1): B4 // CHECK: [B1] @@ -639,6 +642,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B3 B2 // CHECK: [B0 (EXIT)] // CHECK: Preds (3): B1 B2 B3 +// CHECK: int test_cond_unnamed_auto_destructor() // CHECK: [B4 (ENTRY)] // CHECK: Succs (1): B3 // CHECK: [B1] @@ -661,6 +665,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B2 B1 // CHECK: [B0 (EXIT)] // CHECK: Preds (2): B1 B2 +// CHECK: int test_cond_named_auto_destructor() // CHECK: [B4 (ENTRY)] // CHECK: Succs (1): B3 // CHECK: [B1] @@ -688,285 +693,272 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B2 B1 // CHECK: [B0 (EXIT)] // CHECK: Preds (2): B1 B2 -// CHECK: [B16 (ENTRY)] -// CHECK: Succs (1): B15 +// CHECK: [B14 (ENTRY)] +// CHECK: Succs (1): B13 // CHECK: [B1] // CHECK: 1: ~B() (Temporary object destructor) // CHECK: 2: int b; -// CHECK: 3: [B12.4].~A() (Implicit destructor) +// CHECK: 3: [B10.4].~A() (Implicit destructor) // CHECK: Preds (2): B2 B3 // CHECK: Succs (1): B0 // CHECK: [B2] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Preds (1): B3 +// CHECK: Preds (1): B4 // CHECK: Succs (1): B1 // CHECK: [B3] -// CHECK: T: (Temp Dtor) [B6.2] -// CHECK: Preds (2): B4 B5 -// CHECK: Succs (2): B2 B1 -// CHECK: [B4] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) // CHECK: 3: ~A() (Temporary object destructor) // CHECK: 4: ~B() (Temporary object destructor) -// CHECK: Preds (1): B5 -// CHECK: Succs (1): B3 +// CHECK: Preds (1): B4 +// CHECK: Succs (1): B1 +// CHECK: [B4] +// CHECK: 1: [B7.8] ? [B5.6] : [B6.15] +// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B4.2] +// CHECK: 4: [B7.3]([B4.3]) +// CHECK: T: (Temp Dtor) [B7.8] ? ... : ... +// CHECK: Preds (2): B5 B6 +// CHECK: Succs (2): B2 B3 // CHECK: [B5] -// CHECK: 1: [B8.8] ? [B6.6] : [B7.15] -// CHECK: 2: [B5.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B5.2] -// CHECK: 4: [B8.3]([B5.3]) -// CHECK: T: (Temp Dtor) [B7.2] -// CHECK: Preds (2): B6 B7 -// CHECK: Succs (2): B4 B3 -// CHECK: [B6] // CHECK: 1: A() (CXXConstructExpr, class A) +// CHECK: 2: [B5.1] (BindTemporary) +// CHECK: 3: [B5.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B5.3] +// CHECK: 5: [B5.4] (CXXConstructExpr, class A) +// CHECK: 6: [B5.5] (BindTemporary) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 +// CHECK: [B6] +// CHECK: 1: B() (CXXConstructExpr, class B) // CHECK: 2: [B6.1] (BindTemporary) -// CHECK: 3: [B6.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B6.3] -// CHECK: 5: [B6.4] (CXXConstructExpr, class A) +// CHECK: 3: [B6.2].operator A +// CHECK: 4: [B6.2] +// CHECK: 5: [B6.4] (ImplicitCastExpr, UserDefinedConversion, class A) // CHECK: 6: [B6.5] (BindTemporary) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 +// CHECK: 7: [B6.6] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 8: [B6.7] +// CHECK: 9: [B6.8] (CXXConstructExpr, class A) +// CHECK: 10: [B6.9] (BindTemporary) +// CHECK: 11: A([B6.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) +// CHECK: 12: [B6.11] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 13: [B6.12] +// CHECK: 14: [B6.13] (CXXConstructExpr, class A) +// CHECK: 15: [B6.14] (BindTemporary) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 // CHECK: [B7] -// CHECK: 1: B() (CXXConstructExpr, class B) -// CHECK: 2: [B7.1] (BindTemporary) -// CHECK: 3: [B7.2].operator A -// CHECK: 4: [B7.2] -// CHECK: 5: [B7.4] (ImplicitCastExpr, UserDefinedConversion, class A) -// CHECK: 6: [B7.5] (BindTemporary) -// CHECK: 7: [B7.6] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 8: [B7.7] -// CHECK: 9: [B7.8] (CXXConstructExpr, class A) -// CHECK: 10: [B7.9] (BindTemporary) -// CHECK: 11: A([B7.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) -// CHECK: 12: [B7.11] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 13: [B7.12] -// CHECK: 14: [B7.13] (CXXConstructExpr, class A) -// CHECK: 15: [B7.14] (BindTemporary) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 -// CHECK: [B8] // CHECK: 1: ~B() (Temporary object destructor) // CHECK: 2: foo -// CHECK: 3: [B8.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) +// CHECK: 3: [B7.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) // CHECK: 4: B() (CXXConstructExpr, class B) -// CHECK: 5: [B8.4] (BindTemporary) -// CHECK: 6: [B8.5].operator bool -// CHECK: 7: [B8.5] -// CHECK: 8: [B8.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B8.8] ? ... : ... -// CHECK: Preds (2): B9 B10 -// CHECK: Succs (2): B6 B7 +// CHECK: 5: [B7.4] (BindTemporary) +// CHECK: 6: [B7.5].operator bool +// CHECK: 7: [B7.5] +// CHECK: 8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B7.8] ? ... : ... +// CHECK: Preds (2): B8 B9 +// CHECK: Succs (2): B5 B6 +// CHECK: [B8] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: Preds (1): B10 +// CHECK: Succs (1): B7 // CHECK: [B9] // CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: 3: ~B() (Temporary object destructor) // CHECK: Preds (1): B10 -// CHECK: Succs (1): B8 +// CHECK: Succs (1): B7 // CHECK: [B10] -// CHECK: T: (Temp Dtor) [B13.2] +// CHECK: 1: [B13.5] ? [B11.6] : [B12.15] +// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B10.2] +// CHECK: 4: const A &a = B() ? A() : A(B()); +// CHECK: T: (Temp Dtor) [B13.5] ? ... : ... // CHECK: Preds (2): B11 B12 -// CHECK: Succs (2): B9 B8 +// CHECK: Succs (2): B8 B9 // CHECK: [B11] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: 3: ~B() (Temporary object destructor) -// CHECK: Preds (1): B12 +// CHECK: 1: A() (CXXConstructExpr, class A) +// CHECK: 2: [B11.1] (BindTemporary) +// CHECK: 3: [B11.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B11.3] +// CHECK: 5: [B11.4] (CXXConstructExpr, class A) +// CHECK: 6: [B11.5] (BindTemporary) +// CHECK: Preds (1): B13 // CHECK: Succs (1): B10 // CHECK: [B12] -// CHECK: 1: [B15.5] ? [B13.6] : [B14.15] -// CHECK: 2: [B12.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B12.2] -// CHECK: 4: const A &a = B() ? A() : A(B()); -// CHECK: T: (Temp Dtor) [B14.2] -// CHECK: Preds (2): B13 B14 -// CHECK: Succs (2): B11 B10 -// CHECK: [B13] -// CHECK: 1: A() (CXXConstructExpr, class A) -// CHECK: 2: [B13.1] (BindTemporary) -// CHECK: 3: [B13.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B13.3] -// CHECK: 5: [B13.4] (CXXConstructExpr, class A) -// CHECK: 6: [B13.5] (BindTemporary) -// CHECK: Preds (1): B15 -// CHECK: Succs (1): B12 -// CHECK: [B14] // CHECK: 1: B() (CXXConstructExpr, class B) -// CHECK: 2: [B14.1] (BindTemporary) -// CHECK: 3: [B14.2].operator A -// CHECK: 4: [B14.2] -// CHECK: 5: [B14.4] (ImplicitCastExpr, UserDefinedConversion, class A) -// CHECK: 6: [B14.5] (BindTemporary) -// CHECK: 7: [B14.6] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 8: [B14.7] -// CHECK: 9: [B14.8] (CXXConstructExpr, class A) -// CHECK: 10: [B14.9] (BindTemporary) -// CHECK: 11: A([B14.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) -// CHECK: 12: [B14.11] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 13: [B14.12] -// CHECK: 14: [B14.13] (CXXConstructExpr, class A) -// CHECK: 15: [B14.14] (BindTemporary) -// CHECK: Preds (1): B15 -// CHECK: Succs (1): B12 -// CHECK: [B15] +// CHECK: 2: [B12.1] (BindTemporary) +// CHECK: 3: [B12.2].operator A +// CHECK: 4: [B12.2] +// CHECK: 5: [B12.4] (ImplicitCastExpr, UserDefinedConversion, class A) +// CHECK: 6: [B12.5] (BindTemporary) +// CHECK: 7: [B12.6] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 8: [B12.7] +// CHECK: 9: [B12.8] (CXXConstructExpr, class A) +// CHECK: 10: [B12.9] (BindTemporary) +// CHECK: 11: A([B12.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) +// CHECK: 12: [B12.11] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 13: [B12.12] +// CHECK: 14: [B12.13] (CXXConstructExpr, class A) +// CHECK: 15: [B12.14] (BindTemporary) +// CHECK: Preds (1): B13 +// CHECK: Succs (1): B10 +// CHECK: [B13] // CHECK: 1: B() (CXXConstructExpr, class B) -// CHECK: 2: [B15.1] (BindTemporary) -// CHECK: 3: [B15.2].operator bool -// CHECK: 4: [B15.2] -// CHECK: 5: [B15.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B15.5] ? ... : ... -// CHECK: Preds (1): B16 -// CHECK: Succs (2): B13 B14 +// CHECK: 2: [B13.1] (BindTemporary) +// CHECK: 3: [B13.2].operator bool +// CHECK: 4: [B13.2] +// CHECK: 5: [B13.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B13.5] ? ... : ... +// CHECK: Preds (1): B14 +// CHECK: Succs (2): B11 B12 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 -// CHECK: [B9 (ENTRY)] -// CHECK: Succs (1): B8 +// CHECK: [B8 (ENTRY)] +// CHECK: Succs (1): B7 // CHECK: [B1] -// CHECK: 1: int b; -// CHECK: 2: [B5.5].~A() (Implicit destructor) +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: 3: [B4.5].~A() (Implicit destructor) // CHECK: Preds (2): B2 B3 // CHECK: Succs (1): B0 // CHECK: [B2] // CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Preds (1): B3 +// CHECK: Preds (1): B4 // CHECK: Succs (1): B1 // CHECK: [B3] -// CHECK: T: (Temp Dtor) [B6.4] -// CHECK: Preds (2): B4 B5 -// CHECK: Succs (2): B2 B1 -// CHECK: [B4] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Preds (1): B5 -// CHECK: Succs (1): B3 -// CHECK: [B5] -// CHECK: 1: [B8.2] ?: [B7.6] -// CHECK: 2: [B5.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B5.2] -// CHECK: 4: [B5.3] (CXXConstructExpr, class A) +// CHECK: Preds (1): B4 +// CHECK: Succs (1): B1 +// CHECK: [B4] +// CHECK: 1: [B7.2] ?: [B6.6] +// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B4.2] +// CHECK: 4: [B4.3] (CXXConstructExpr, class A) // CHECK: 5: A a = A() ?: A(); -// CHECK: T: (Temp Dtor) [B7.2] -// CHECK: Preds (2): B6 B7 -// CHECK: Succs (2): B4 B3 +// CHECK: T: (Temp Dtor) [B7.5] ? ... : ... +// CHECK: Preds (2): B5 B6 +// CHECK: Succs (2): B2 B3 +// CHECK: [B5] +// CHECK: 1: [B7.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 2: [B5.1] +// CHECK: 3: [B5.2] (CXXConstructExpr, class A) +// CHECK: 4: [B5.3] (BindTemporary) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 // CHECK: [B6] -// CHECK: 1: [B8.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 2: [B6.1] -// CHECK: 3: [B6.2] (CXXConstructExpr, class A) -// CHECK: 4: [B6.3] (BindTemporary) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 +// CHECK: 1: A() (CXXConstructExpr, class A) +// CHECK: 2: [B6.1] (BindTemporary) +// CHECK: 3: [B6.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B6.3] +// CHECK: 5: [B6.4] (CXXConstructExpr, class A) +// CHECK: 6: [B6.5] (BindTemporary) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 // CHECK: [B7] // CHECK: 1: A() (CXXConstructExpr, class A) // CHECK: 2: [B7.1] (BindTemporary) -// CHECK: 3: [B7.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B7.3] -// CHECK: 5: [B7.4] (CXXConstructExpr, class A) -// CHECK: 6: [B7.5] (BindTemporary) +// CHECK: 3: [B7.2].operator bool +// CHECK: 4: [B7.2] +// CHECK: 5: [B7.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B7.5] ? ... : ... // CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 -// CHECK: [B8] -// CHECK: 1: A() (CXXConstructExpr, class A) -// CHECK: 2: [B8.1] (BindTemporary) -// CHECK: 3: [B8.2].operator bool -// CHECK: 4: [B8.2] -// CHECK: 5: [B8.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B8.5] ? ... : ... -// CHECK: Preds (1): B9 -// CHECK: Succs (2): B6 B7 +// CHECK: Succs (2): B5 B6 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 -// CHECK: [B14 (ENTRY)] -// CHECK: Succs (1): B13 +// CHECK: [B13 (ENTRY)] +// CHECK: Succs (1): B12 // CHECK: [B1] -// CHECK: 1: int b; -// CHECK: 2: [B10.4].~A() (Implicit destructor) +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: 3: [B9.4].~A() (Implicit destructor) // CHECK: Preds (2): B2 B3 // CHECK: Succs (1): B0 // CHECK: [B2] // CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Preds (1): B3 +// CHECK: Preds (1): B4 // CHECK: Succs (1): B1 // CHECK: [B3] -// CHECK: T: (Temp Dtor) [B6.4] -// CHECK: Preds (2): B4 B5 -// CHECK: Succs (2): B2 B1 -// CHECK: [B4] // CHECK: 1: ~A() (Temporary object destructor) // CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Preds (1): B5 -// CHECK: Succs (1): B3 +// CHECK: Preds (1): B4 +// CHECK: Succs (1): B1 +// CHECK: [B4] +// CHECK: 1: [B7.5] ?: [B6.6] +// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B4.2] +// CHECK: 4: [B7.3]([B4.3]) +// CHECK: T: (Temp Dtor) [B7.8] ? ... : ... +// CHECK: Preds (2): B5 B6 +// CHECK: Succs (2): B2 B3 // CHECK: [B5] -// CHECK: 1: [B8.4] ?: [B7.6] -// CHECK: 2: [B5.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B5.2] -// CHECK: 4: [B8.2]([B5.3]) -// CHECK: T: (Temp Dtor) [B7.2] -// CHECK: Preds (2): B6 B7 -// CHECK: Succs (2): B4 B3 +// 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) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 // CHECK: [B6] -// CHECK: 1: [B8.4] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 2: [B6.1] -// CHECK: 3: [B6.2] (CXXConstructExpr, class A) -// CHECK: 4: [B6.3] (BindTemporary) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 -// CHECK: [B7] // CHECK: 1: A() (CXXConstructExpr, class A) -// CHECK: 2: [B7.1] (BindTemporary) -// CHECK: 3: [B7.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B7.3] -// CHECK: 5: [B7.4] (CXXConstructExpr, class A) -// CHECK: 6: [B7.5] (BindTemporary) -// CHECK: Preds (1): B8 -// CHECK: Succs (1): B5 +// CHECK: 2: [B6.1] (BindTemporary) +// CHECK: 3: [B6.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B6.3] +// CHECK: 5: [B6.4] (CXXConstructExpr, class A) +// CHECK: 6: [B6.5] (BindTemporary) +// CHECK: Preds (1): B7 +// CHECK: Succs (1): B4 +// CHECK: [B7] +// CHECK: 1: ~A() (Temporary object destructor) +// 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.5] +// CHECK: 8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B7.8] ? ... : ... +// CHECK: Preds (2): B9 B8 +// CHECK: Succs (2): B5 B6 // CHECK: [B8] -// CHECK: 1: foo -// CHECK: 2: [B8.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) -// CHECK: 3: A() (CXXConstructExpr, class A) -// CHECK: 4: [B8.3] (BindTemporary) -// CHECK: 5: [B8.4].operator bool -// CHECK: 6: [B8.4] -// CHECK: 7: [B8.6] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B8.7] ? ... : ... -// CHECK: Preds (2): B9 B10 -// CHECK: Succs (2): B6 B7 -// CHECK: [B9] // CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Preds (1): B10 -// CHECK: Succs (1): B8 -// CHECK: [B10] -// CHECK: 1: [B13.2] ?: [B12.6] -// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 3: [B10.2] +// CHECK: Preds (1): B9 +// CHECK: Succs (1): B7 +// CHECK: [B9] +// CHECK: 1: [B12.2] ?: [B11.6] +// CHECK: 2: [B9.1] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 3: [B9.2] // CHECK: 4: const A &a = A() ?: A(); -// CHECK: T: (Temp Dtor) [B12.2] -// CHECK: Preds (2): B11 B12 -// CHECK: Succs (2): B9 B8 +// CHECK: T: (Temp Dtor) [B12.5] ? ... : ... +// CHECK: Preds (2): B10 B11 +// CHECK: Succs (2): B7 B8 +// CHECK: [B10] +// CHECK: 1: [B12.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 2: [B10.1] +// CHECK: 3: [B10.2] (CXXConstructExpr, class A) +// CHECK: 4: [B10.3] (BindTemporary) +// CHECK: Preds (1): B12 +// CHECK: Succs (1): B9 // CHECK: [B11] -// CHECK: 1: [B13.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 2: [B11.1] -// CHECK: 3: [B11.2] (CXXConstructExpr, class A) -// CHECK: 4: [B11.3] (BindTemporary) -// CHECK: Preds (1): B13 -// CHECK: Succs (1): B10 +// CHECK: 1: A() (CXXConstructExpr, class A) +// CHECK: 2: [B11.1] (BindTemporary) +// CHECK: 3: [B11.2] (ImplicitCastExpr, NoOp, const class A) +// CHECK: 4: [B11.3] +// CHECK: 5: [B11.4] (CXXConstructExpr, class A) +// CHECK: 6: [B11.5] (BindTemporary) +// CHECK: Preds (1): B12 +// CHECK: Succs (1): B9 // CHECK: [B12] // CHECK: 1: A() (CXXConstructExpr, class A) // CHECK: 2: [B12.1] (BindTemporary) -// CHECK: 3: [B12.2] (ImplicitCastExpr, NoOp, const class A) -// CHECK: 4: [B12.3] -// CHECK: 5: [B12.4] (CXXConstructExpr, class A) -// CHECK: 6: [B12.5] (BindTemporary) +// CHECK: 3: [B12.2].operator bool +// CHECK: 4: [B12.2] +// CHECK: 5: [B12.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CHECK: T: [B12.5] ? ... : ... // CHECK: Preds (1): B13 -// CHECK: Succs (1): B10 -// CHECK: [B13] -// CHECK: 1: A() (CXXConstructExpr, class A) -// CHECK: 2: [B13.1] (BindTemporary) -// CHECK: 3: [B13.2].operator bool -// CHECK: 4: [B13.2] -// CHECK: 5: [B13.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: [B13.5] ? ... : ... -// CHECK: Preds (1): B14 -// CHECK: Succs (2): B11 B12 +// CHECK: Succs (2): B10 B11 // CHECK: [B0 (EXIT)] // CHECK: Preds (1): B1 // CHECK: [B2 (ENTRY)] @@ -1097,7 +1089,6 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B2 // CHECK: [B1] // CHECK: 1: int b; -// CHECK: Preds (1): B2(Unreachable) // CHECK: Succs (1): B0 // CHECK: [B2 (NORETURN)] // CHECK: 1: int a; @@ -1114,7 +1105,6 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B2 // CHECK: [B1] // CHECK: 1: int b; -// CHECK: Preds (1): B2(Unreachable) // CHECK: Succs (1): B0 // CHECK: [B2 (NORETURN)] // CHECK: 1: int a; @@ -1127,6 +1117,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B0 (EXIT)] // CHECK: Preds (2): B1 B2 +// CHECK: int testConsistencyNestedSimple(bool value) // CHECK: [B9 (ENTRY)] // CHECK: Succs (1): B8 // CHECK: [B1] @@ -1141,7 +1132,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B3] // CHECK: T: if [B5.1] -// CHECK: Preds (2): B4(Unreachable) B5 +// CHECK: Preds (1): B5 // CHECK: Succs (2): B2 B1 // CHECK: [B4 (NORETURN)] // CHECK: 1: ~NoReturn() (Temporary object destructor) @@ -1149,9 +1140,9 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B5] // CHECK: 1: [B7.3] || [B6.7] -// CHECK: T: (Temp Dtor) [B6.4] +// CHECK: T: (Temp Dtor) [B7.3] || ... // CHECK: Preds (2): B6 B7 -// CHECK: Succs (2): B4 B3 +// CHECK: Succs (2): B3 B4 // CHECK: [B6] // CHECK: 1: check // CHECK: 2: [B6.1] (ImplicitCastExpr, FunctionToPointerDecay, _Bool (*)(const class NoReturn &)) @@ -1177,6 +1168,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B7 B1 // CHECK: [B0 (EXIT)] // CHECK: Preds (3): B1 B2 B4 +// CHECK: int testConsistencyNestedComplex(bool value) // CHECK: [B10 (ENTRY)] // CHECK: Succs (1): B9 // CHECK: [B1] @@ -1191,7 +1183,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B3] // CHECK: T: if [B5.1] -// CHECK: Preds (2): B4(Unreachable) B5 +// CHECK: Preds (1): B5 // CHECK: Succs (2): B2 B1 // CHECK: [B4 (NORETURN)] // CHECK: 1: ~NoReturn() (Temporary object destructor) @@ -1199,9 +1191,9 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B5] // CHECK: 1: [B8.3] || [B7.3] || [B6.7] -// CHECK: T: (Temp Dtor) [B6.4] +// CHECK: T: (Temp Dtor) [B8.3] || [B7.3] || ... // CHECK: Preds (3): B6 B7 B8 -// CHECK: Succs (2): B4 B3 +// CHECK: Succs (2): B3 B4 // CHECK: [B6] // CHECK: 1: check // CHECK: 2: [B6.1] (ImplicitCastExpr, FunctionToPointerDecay, _Bool (*)(const class NoReturn &)) @@ -1234,6 +1226,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (2): B8 B1 // CHECK: [B0 (EXIT)] // CHECK: Preds (3): B1 B2 B4 +// CHECK: int testConsistencyNestedNormalReturn(bool value) // CHECK: [B10 (ENTRY)] // CHECK: Succs (1): B9 // CHECK: [B1] @@ -1248,7 +1241,7 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B3] // CHECK: T: if [B5.1] -// CHECK: Preds (2): B4(Unreachable) B5 +// CHECK: Preds (1): B5 // CHECK: Succs (2): B2 B1 // CHECK: [B4 (NORETURN)] // CHECK: 1: ~NoReturn() (Temporary object destructor) @@ -1256,9 +1249,9 @@ int testConsistencyNestedNormalReturn(bool value) { // CHECK: Succs (1): B0 // CHECK: [B5] // CHECK: 1: [B8.3] || [B7.2] || [B6.7] -// CHECK: T: (Temp Dtor) [B6.4] +// CHECK: T: (Temp Dtor) [B8.3] || [B7.2] || ... // CHECK: Preds (3): B6 B7 B8 -// CHECK: Succs (2): B4 B3 +// CHECK: Succs (2): B3 B4 // CHECK: [B6] // CHECK: 1: check // CHECK: 2: [B6.1] (ImplicitCastExpr, FunctionToPointerDecay, _Bool (*)(const class NoReturn &)) diff --git a/clang/test/Analysis/temporaries.cpp b/clang/test/Analysis/temporaries.cpp index 0cc90880f44..c57d984a1dc 100644 --- a/clang/test/Analysis/temporaries.cpp +++ b/clang/test/Analysis/temporaries.cpp @@ -1,9 +1,8 @@ // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++03 %s // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++11 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -DTEMPORARY_DTORS -verify -w -analyzer-config cfg-temporary-dtors=true %s -std=c++11 +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -DTEMPORARY_DTORS -verify -w -analyzer-config cfg-temporary-dtors=true %s extern bool clang_analyzer_eval(bool); -extern bool clang_analyzer_warnIfReached(); struct Trivial { Trivial(int x) : value(x) {} @@ -112,13 +111,13 @@ namespace compound_literals { } namespace destructors { - struct Dtor { - ~Dtor(); - }; - extern bool coin(); - extern bool check(const Dtor &); - void testPR16664andPR18159Crash() { + struct Dtor { + ~Dtor(); + }; + extern bool coin(); + extern bool check(const Dtor &); + // Regression test: we used to assert here when tmp dtors are enabled. // PR16664 and PR18159 if (coin() && (coin() || coin() || check(Dtor()))) { @@ -194,7 +193,8 @@ namespace destructors { (i == 4 || i == 4 || compute(i == 5 && (i == 4 || check(NoReturnDtor()))))) || i != 4) { - clang_analyzer_eval(true); // no warning, unreachable code + // FIXME: This shouldn't cause a warning. + clang_analyzer_eval(true); // expected-warning{{TRUE}} } } @@ -211,7 +211,8 @@ namespace destructors { void testConsistencyNestedComplex(bool value) { if (value) { if (!value || !value || check(NoReturnDtor())) { - clang_analyzer_eval(true); // no warning, unreachable code + // FIXME: This shouldn't cause a warning. + clang_analyzer_eval(true); // expected-warning{{TRUE}} } } } @@ -224,112 +225,6 @@ namespace destructors { } } } - // PR16664 and PR18159 - void testConsistencyNestedComplexMidBranch(bool value) { - if (value) { - if (!value || !value || check(NoReturnDtor()) || value) { - clang_analyzer_eval(true); // no warning, unreachable code - } - } - } - - // PR16664 and PR18159 - void testConsistencyNestedComplexNestedBranch(bool value) { - if (value) { - if (!value || (!value || check(NoReturnDtor()) || value)) { - clang_analyzer_eval(true); // no warning, unreachable code - } - } - } - - // PR16664 and PR18159 - void testConsistencyNestedVariableModification(bool value) { - bool other = true; - if (value) { - if (!other || !value || (other = false) || check(NoReturnDtor()) || - !other) { - clang_analyzer_eval(true); // no warning, unreachable code - } - } - } - - void testTernaryNoReturnTrueBranch(bool value) { - if (value) { - bool b = value && value ? check(NoReturnDtor()) : true; - clang_analyzer_eval(true); // no warning, unreachable code - } - } - void testTernaryNoReturnFalseBranch(bool value) { - if (value) { - bool b = !value && !value ? true : check(NoReturnDtor()); - clang_analyzer_eval(true); // no warning, unreachable code - } - } - void testTernaryIgnoreNoreturnBranch(bool value) { - if (value) { - bool b = !value && !value ? check(NoReturnDtor()) : true; - clang_analyzer_eval(true); // expected-warning{{TRUE}} - } - } - - void testLoop() { - for (int i = 0; i < 10; ++i) { - if (i < 3 && (i >= 2 || check(NoReturnDtor()))) { - clang_analyzer_eval(true); // no warning, unreachable code - } - } - } - - bool testRecursiveFrames(bool isInner) { - if (isInner || - (clang_analyzer_warnIfReached(), false) || // expected-warning{{REACHABLE}} - check(NoReturnDtor()) || - testRecursiveFrames(true)) { - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } - } - void testRecursiveFramesStart() { testRecursiveFrames(false); } - - void testLambdas() { - // This is the test we would like to write: - // []() { check(NoReturnDtor()); } != nullptr || check(Dtor()); - // But currently the analyzer stops when it encounters a lambda: - [] {}; - // The CFG for this now looks correct, but we still do not reach the line - // below. - clang_analyzer_warnIfReached(); // FIXME: Should warn. - } - - void testGnuExpressionStatements(int v) { - ({ ++v; v == 10 || check(NoReturnDtor()); v == 42; }) || v == 23; - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - - ({ ++v; check(NoReturnDtor()); v == 42; }) || v == 23; - clang_analyzer_warnIfReached(); // no warning, unreachable code - } - - void testGnuExpressionStatementsDestructionPoint(int v) { - // In normal context, the temporary destructor runs at the end of the full - // statement, thus the last statement is reached. - (++v, check(NoReturnDtor()), v == 42), - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - - // GNU expression statements execute temporary destructors within the - // blocks, thus the last statement is not reached. - ({ ++v; check(NoReturnDtor()); v == 42; }), - clang_analyzer_warnIfReached(); // no warning, unreachable code - } - - void testMultipleTemporaries(bool value) { - if (value) { - // FIXME: Find a way to verify construction order. - // ~Dtor should run before ~NoReturnDtor() because construction order is - // guaranteed by comma operator. - if (!value || check((NoReturnDtor(), Dtor())) || value) { - clang_analyzer_eval(true); // no warning, unreachable code - } - } - } void testBinaryOperatorShortcut(bool value) { if (value) { @@ -339,52 +234,6 @@ namespace destructors { } } - void testIfAtEndOfLoop() { - int y = 0; - while (true) { - if (y > 0) { - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } - ++y; - // Test that the CFG gets hooked up correctly when temporary destructors - // are handled after a statically known branch condition. - if (true) (void)0; else (void)check(NoReturnDtor()); - } - } - - void testTernaryAtEndOfLoop() { - int y = 0; - while (true) { - if (y > 0) { - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } - ++y; - // Test that the CFG gets hooked up correctly when temporary destructors - // are handled after a statically known branch condition. - true ? (void)0 : (void)check(NoReturnDtor()); - } - } - - void testNoReturnInComplexCondition() { - check(Dtor()) && - (check(NoReturnDtor()) || check(NoReturnDtor())) && check(Dtor()); - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } - - void testSequencingOfConditionalTempDtors(bool b) { - b || (check(Dtor()), check(NoReturnDtor())); - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } - - void testSequencingOfConditionalTempDtors2(bool b) { - (b || check(Dtor())), check(NoReturnDtor()); - clang_analyzer_warnIfReached(); // no warning, unreachable code - } - - void testSequencingOfConditionalTempDtorsWithinBinaryOperators(bool b) { - b || (check(Dtor()) + check(NoReturnDtor())); - clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} - } #endif // TEMPORARY_DTORS } |