• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCallGraph %s -fblocks 2>&1 | FileCheck %s
2 
mmm(int y)3 static void mmm(int y) {
4   if (y != 0)
5       y++;
6   y = y/y;
7 }
8 
foo(int x,int y)9 static int foo(int x, int y) {
10     mmm(y);
11     if (x != 0)
12       x++;
13     return 5/x;
14 }
15 
aaa()16 void aaa() {
17   foo(1,2);
18 }
19 
bbb(int y)20 void bbb(int y) {
21   int x = (y > 2);
22   ^ {
23       foo(x, y);
24   }();
25 }
26 void ccc();
ddd()27 void ddd() { ccc(); }
ccc()28 void ccc() {}
29 
30 void eee();
eee()31 void eee() {}
fff()32 void fff() { eee(); }
33 
34 // CHECK:--- Call graph Dump ---
35 // CHECK-NEXT: {{Function: < root > calls: mmm foo aaa < > bbb ccc ddd eee fff $}}
36 // CHECK-NEXT: {{Function: fff calls: eee $}}
37 // CHECK-NEXT: {{Function: eee calls: $}}
38 // CHECK-NEXT: {{Function: ddd calls: ccc $}}
39 // CHECK-NEXT: {{Function: ccc calls: $}}
40 // CHECK-NEXT: {{Function: bbb calls: < > $}}
41 // CHECK-NEXT: {{Function: < > calls: foo $}}
42 // CHECK-NEXT: {{Function: aaa calls: foo $}}
43 // CHECK-NEXT: {{Function: foo calls: mmm $}}
44 // CHECK-NEXT: {{Function: mmm calls: $}}
45