summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/cxx-callgraph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/cxx-callgraph.cpp')
-rw-r--r--clang/test/Analysis/cxx-callgraph.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/Analysis/cxx-callgraph.cpp b/clang/test/Analysis/cxx-callgraph.cpp
new file mode 100644
index 00000000000..4a48e422ce0
--- /dev/null
+++ b/clang/test/Analysis/cxx-callgraph.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCallGraph %s 2>&1 | FileCheck %s
+
+static int aaa() {
+ return 0;
+}
+
+static int bbb(int param=aaa()) {
+ return 1;
+}
+
+int ddd();
+
+struct c {
+ c(int param=2) : val(bbb(param)) {}
+ int val;
+ int val2 = ddd();
+};
+
+int ddd() {
+ c c;
+ return bbb();
+}
+
+// CHECK:--- Call graph Dump ---
+// CHECK-NEXT: {{Function: < root > calls: aaa bbb c::c ddd}}
+// CHECK-NEXT: {{Function: c::c calls: bbb ddd $}}
+// CHECK-NEXT: {{Function: ddd calls: c::c bbb aaa $}}
+// CHECK-NEXT: {{Function: bbb calls: $}}
+// CHECK-NEXT: {{Function: aaa calls: $}}
OpenPOWER on IntegriCloud