mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 07:56:07 +00:00

This patch improves Clang call graph analysis by adding in expressions that are not found in regular function bodies, such as default arguments or member initializers. Patch by Joshua Cranmer! Differential Revision: https://reviews.llvm.org/D65453 llvm-svn: 369321
30 lines
591 B
C++
30 lines
591 B
C++
// 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: $}}
|