summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-07-02 02:17:50 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-07-02 02:17:50 +0000
commit0a77d9192ab75b8fcf218747d6bcd213dce1f4ce (patch)
treed647ff4bb47a6787fc715bee3bb07b880e10b78b /clang/test
parent745379a0af74a37465f616b99c10a09b4f0d2add (diff)
downloadbcm5719-llvm-0a77d9192ab75b8fcf218747d6bcd213dce1f4ce.tar.gz
bcm5719-llvm-0a77d9192ab75b8fcf218747d6bcd213dce1f4ce.zip
[analyzer] exploded-graph-rewriter: Add support for objects under construction.
This trait is Environment-like, so there was a chance to re-use a lot of code. Differential Revision: https://reviews.llvm.org/D64047 llvm-svn: 364880
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/constraints.dot1
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/constraints_diff.dot5
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/environment.dot1
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/environment_diff.dot3
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp25
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp48
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/store.dot1
-rw-r--r--clang/test/Analysis/exploded-graph-rewriter/store_diff.dot2
8 files changed, 85 insertions, 1 deletions
diff --git a/clang/test/Analysis/exploded-graph-rewriter/constraints.dot b/clang/test/Analysis/exploded-graph-rewriter/constraints.dot
index 49aba4b15e1..58faafc0f26 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/constraints.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/constraints.dot
@@ -20,6 +20,7 @@ Node0x1 [shape=record,label=
"store": null,
"environment": null,
"dynamic_types": null,
+ "constructing_objects": null,
"constraints": [
{ "symbol": "reg_$0<x>", "range": "{ [0, 0] }" }
]
diff --git a/clang/test/Analysis/exploded-graph-rewriter/constraints_diff.dot b/clang/test/Analysis/exploded-graph-rewriter/constraints_diff.dot
index 068ef58d25c..24aa9b41a7a 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/constraints_diff.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/constraints_diff.dot
@@ -13,6 +13,7 @@ Node0x1 [shape=record,label=
"store": null,
"environment": null,
"dynamic_types": null,
+ "constructing_objects": null,
"constraints": [
{ "symbol": "reg_$0<x>", "range": "{ [0, 10] }" }
]
@@ -43,6 +44,7 @@ Node0x3 [shape=record,label=
"store": null,
"environment": null,
"dynamic_types": null,
+ "constructing_objects": null,
"constraints": [
{ "symbol": "reg_$0<x>", "range": "{ [0, 5] }" }
]
@@ -62,7 +64,8 @@ Node0x5 [shape=record,label=
"store": null,
"environment": null,
"constraints": null,
- "dynamic_types": null
+ "dynamic_types": null,
+ "constructing_objects": null
}
}
\l}"];
diff --git a/clang/test/Analysis/exploded-graph-rewriter/environment.dot b/clang/test/Analysis/exploded-graph-rewriter/environment.dot
index 4c6c93b85de..3a54c6ecb1e 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/environment.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/environment.dot
@@ -35,6 +35,7 @@ Node0x1 [shape=record,label=
"store": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"environment": {
"pointer": "0x2",
"items": [
diff --git a/clang/test/Analysis/exploded-graph-rewriter/environment_diff.dot b/clang/test/Analysis/exploded-graph-rewriter/environment_diff.dot
index ac41cdf97f0..5264b40f802 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/environment_diff.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/environment_diff.dot
@@ -14,6 +14,7 @@ Node0x1 [shape=record,label=
"store": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"environment": {
"pointer": "0x2",
"items": [
@@ -61,6 +62,7 @@ Node0x6 [shape=record,label=
"store": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"environment": {
"pointer": "0x2",
"items": [
@@ -102,6 +104,7 @@ Node0x9 [shape=record,label=
"store": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"environment": {
"pointer": "0x2",
"items": [
diff --git a/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp b/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
new file mode 100644
index 00000000000..472627ef619
--- /dev/null
+++ b/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
@@ -0,0 +1,25 @@
+// FIXME: Figure out how to use %clang_analyze_cc1 with our lit.local.cfg.
+// RUN: %clang_cc1 -analyze -triple x86_64-unknown-linux-gnu \
+// RUN: -analyzer-checker=core \
+// RUN: -analyzer-dump-egraph=%t.dot %s
+// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
+// REQUIRES: asserts
+
+// FIXME: Substitution doesn't seem to work on Windows.
+// UNSUPPORTED: system-windows
+
+struct A {
+ A() {}
+};
+
+struct B {
+ A a;
+ B() : a() {}
+};
+
+void test() {
+ // CHECK: (construct into member variable)
+ // CHECK-SAME: <td align="left">a</td>
+ // CHECK-SAME: <td align="left">&amp;b-&gt;a</td>
+ B b;
+}
diff --git a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
new file mode 100644
index 00000000000..c2a805f099c
--- /dev/null
+++ b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
@@ -0,0 +1,48 @@
+// FIXME: Figure out how to use %clang_analyze_cc1 with our lit.local.cfg.
+// RUN: %clang_cc1 -analyze -triple x86_64-unknown-linux-gnu \
+// RUN: -analyzer-checker=core \
+// RUN: -analyzer-dump-egraph=%t.dot %s
+// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
+// REQUIRES: asserts
+
+// FIXME: Substitution doesn't seem to work on Windows.
+// UNSUPPORTED: system-windows
+
+struct S {
+ S() {}
+};
+
+void test() {
+ // CHECK: Objects Under Construction:
+ // CHECK-SAME: <tr>
+ // CHECK-SAME: <td align="left"><b>#0 Call</b></td>
+ // CHECK-SAME: <td align="left" colspan="2">
+ // CHECK-SAME: <font color="grey60">test </font>
+ // CHECK-SAME: </td>
+ // CHECK-SAME: </tr>
+ // CHECK-SAME: <tr>
+ // CHECK-SAME: <td align="left"><i>S{{[0-9]*}}</i></td>
+ // CHECK-SAME: <td align="left"><font color="darkgreen"><i>
+ // CHECK-SAME: (materialize temporary)
+ // CHECK-SAME: </i></font></td>
+ // CHECK-SAME: <td align="left">S()</td>
+ // CHECK-SAME: <td align="left">&amp;s</td>
+ // CHECK-SAME: </tr>
+ // CHECK-SAME: <tr>
+ // CHECK-SAME: <td align="left"><i>S{{[0-9]*}}</i></td>
+ // CHECK-SAME: <td align="left"><font color="darkgreen"><i>
+ // CHECK-SAME: (elide constructor)
+ // CHECK-SAME: </i></font></td>
+ // CHECK-SAME: <td align="left">S()</td>
+ // CHECK-SAME: <td align="left">&amp;s</td>
+ // CHECK-SAME: </tr>
+ // CHECK-SAME: <tr>
+ // CHECK-SAME: <td align="left"><i>S{{[0-9]*}}</i></td>
+ // CHECK-SAME: <td align="left"><font color="darkgreen"><i>
+ // CHECK-SAME: (construct into local variable)
+ // CHECK-SAME: </i></font></td>
+ // CHECK-SAME: <td align="left">S s = S();</td>
+ // CHECK-SAME: <td align="left">&amp;s</td>
+ // CHECK-SAME: </tr>
+ S s = S();
+}
diff --git a/clang/test/Analysis/exploded-graph-rewriter/store.dot b/clang/test/Analysis/exploded-graph-rewriter/store.dot
index f431319cc6d..1c306ce160f 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/store.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/store.dot
@@ -30,6 +30,7 @@ Node0x1 [shape=record,label=
"environment": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"store": {
"pointer": "0x2",
"items": [
diff --git a/clang/test/Analysis/exploded-graph-rewriter/store_diff.dot b/clang/test/Analysis/exploded-graph-rewriter/store_diff.dot
index ab36e5f9869..ddd26ce5dcd 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/store_diff.dot
+++ b/clang/test/Analysis/exploded-graph-rewriter/store_diff.dot
@@ -13,6 +13,7 @@ Node0x1 [shape=record,label=
"environment": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"store": {
"pointer": "0x2",
"items": [
@@ -59,6 +60,7 @@ Node0x4 [shape=record,label=
"environment": null,
"constraints": null,
"dynamic_types": null,
+ "constructing_objects": null,
"store": {
"pointer": "0x5",
"items": [
OpenPOWER on IntegriCloud