summaryrefslogtreecommitdiff
path: root/test/Analysis/initializers-cfg-output.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/initializers-cfg-output.cpp')
-rw-r--r--test/Analysis/initializers-cfg-output.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/test/Analysis/initializers-cfg-output.cpp b/test/Analysis/initializers-cfg-output.cpp
index ccf4db519d795..8d1039ddf34ed 100644
--- a/test/Analysis/initializers-cfg-output.cpp
+++ b/test/Analysis/initializers-cfg-output.cpp
@@ -1,4 +1,14 @@
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=false %s 2>&1 | FileCheck -check-prefixes=CHECK,WARNINGS %s
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=true %s 2>&1 | FileCheck -check-prefixes=CHECK,ANALYZER %s
+
+// This file tests how we construct two different flavors of the Clang CFG -
+// the CFG used by the Sema analysis-based warnings and the CFG used by the
+// static analyzer. The difference in the behavior is checked via FileCheck
+// prefixes (WARNINGS and ANALYZER respectively). When introducing new analyzer
+// flags, no new run lines should be added - just these flags would go to the
+// respective line depending on where is it turned on and where is it turned
+// off. Feel free to add tests that test only one of the CFG flavors if you're
+// not sure how the other flavor is supposed to work in your case.
class A {
public:
@@ -53,20 +63,25 @@ class TestDelegating {
// CHECK: [B2 (ENTRY)]
// CHECK: Succs (1): B1
// CHECK: [B1]
-// CHECK: 1: (CXXConstructExpr, class A)
+// WARNINGS: 1: (CXXConstructExpr, class A)
+// ANALYZER: 1: (CXXConstructExpr, A() (Base initializer), class A)
// CHECK: 2: A([B1.1]) (Base initializer)
-// CHECK: 3: (CXXConstructExpr, class C)
+// WARNINGS: 3: (CXXConstructExpr, class C)
+// ANALYZER: 3: (CXXConstructExpr, C() (Base initializer), class C)
// CHECK: 4: C([B1.3]) (Base initializer)
-// CHECK: 5: (CXXConstructExpr, class B)
+// WARNINGS: 5: (CXXConstructExpr, class B)
+// ANALYZER: 5: (CXXConstructExpr, B() (Base initializer), class B)
// CHECK: 6: B([B1.5]) (Base initializer)
-// CHECK: 7: (CXXConstructExpr, class A)
+// WARNINGS: 7: (CXXConstructExpr, class A)
+// ANALYZER: 7: (CXXConstructExpr, A() (Base initializer), class A)
// CHECK: 8: A([B1.7]) (Base initializer)
// CHECK: 9: /*implicit*/(int)0
// CHECK: 10: i([B1.9]) (Member initializer)
// CHECK: 11: this
// CHECK: 12: [B1.11]->i
// CHECK: 13: r([B1.12]) (Member initializer)
-// CHECK: 14: (CXXConstructExpr, class A)
+// WARNINGS: 14: (CXXConstructExpr, class A)
+// ANALYZER: 14: (CXXConstructExpr, [B1.15], class A)
// CHECK: 15: A a;
// CHECK: Preds (1): B2
// CHECK: Succs (1): B0
@@ -107,7 +122,8 @@ class TestDelegating {
// CHECK: [B1]
// CHECK: 1: 2
// CHECK: 2: 3
-// CHECK: 3: [B1.1], [B1.2] (CXXConstructExpr, class TestDelegating)
+// WARNINGS: 3: [B1.1], [B1.2] (CXXConstructExpr, class TestDelegating)
+// ANALYZER: 3: [B1.1], [B1.2] (CXXConstructExpr, TestDelegating([B1.1], [B1.2]) (Delegating initializer), class TestDelegating)
// CHECK: 4: TestDelegating([B1.3]) (Delegating initializer)
// CHECK: Preds (1): B2
// CHECK: Succs (1): B0