1 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCallGraph %s -fblocks -std=c++14 2>&1 | FileCheck %s
7 int add(int val1
, int val2
) {
12 return add(10, get5());
15 static void mmm(int y
) {
21 static int foo(int x
, int y
) {
46 // This test case tests that forward declaration for the top-level function
47 // does not affect call graph construction.
49 void test_single_call();
50 void test_single_call() {
61 void templ
<double>(double t
) {
94 void SomeOtherDecl() {
99 // CHECK:--- Call graph Dump ---
100 // CHECK-NEXT: {{Function: < root > calls: get5 add test_add mmm foo aaa < > bbb ddd ccc eee fff do_nothing test_single_call SomeNS::templ SomeNS::templ SomeNS::templUser Lambdas::Callee Lambdas::f1 Lambdas::f1\(\)::\(anonymous class\)::operator\(\) Lambdas::f1\(\)::\(anonymous class\)::operator\(\) CallDecl::SomeDef CallDecl::Caller CallDecl::SomeDecl CallDecl::SomeOtherDecl $}}
101 // CHECK-NEXT: {{Function: CallDecl::Caller calls: CallDecl::SomeDecl CallDecl::SomeOtherDecl $}}
102 // CHECK-NEXT: {{Function: CallDecl::SomeOtherDecl calls: CallDecl::SomeDef $}}
103 // CHECK-NEXT: {{Function: CallDecl::SomeDecl calls: $}}
104 // CHECK-NEXT: {{Function: CallDecl::SomeDef calls: $}}
105 // CHECK-NEXT: {{Function: Lambdas::f1 calls: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) Lambdas::f1\(\)::\(anonymous class\)::operator\(\) $}}
106 // CHECK-NEXT: {{Function: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) calls: Lambdas::Callee $}}
107 // CHECK-NEXT: {{Function: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) calls: Lambdas::Callee $}}
108 // CHECK-NEXT: {{Function: Lambdas::Callee calls: $}}
109 // CHECK-NEXT: {{Function: SomeNS::templUser calls: SomeNS::templ SomeNS::templ $}}
110 // CHECK-NEXT: {{Function: SomeNS::templ calls: eee $}}
111 // CHECK-NEXT: {{Function: SomeNS::templ calls: ccc $}}
112 // CHECK-NEXT: {{Function: test_single_call calls: do_nothing $}}
113 // CHECK-NEXT: {{Function: do_nothing calls: $}}
114 // CHECK-NEXT: {{Function: fff calls: eee $}}
115 // CHECK-NEXT: {{Function: eee calls: $}}
116 // CHECK-NEXT: {{Function: ddd calls: ccc $}}
117 // CHECK-NEXT: {{Function: ccc calls: $}}
118 // CHECK-NEXT: {{Function: bbb calls: < > $}}
119 // CHECK-NEXT: {{Function: < > calls: foo $}}
120 // CHECK-NEXT: {{Function: aaa calls: foo $}}
121 // CHECK-NEXT: {{Function: foo calls: mmm $}}
122 // CHECK-NEXT: {{Function: mmm calls: $}}
123 // CHECK-NEXT: {{Function: test_add calls: add get5 $}}
124 // CHECK-NEXT: {{Function: add calls: $}}
125 // CHECK-NEXT: {{Function: get5 calls: $}}