[PATCH] D28905: [analyzer] Consider function call arguments while building CallGraph
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 27 04:26:05 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293280: [analyzer] Consider function call arguments while building CallGraph. (authored by dergachev).
Changed prior to commit:
https://reviews.llvm.org/D28905?vs=84973&id=86041#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28905
Files:
cfe/trunk/lib/Analysis/CallGraph.cpp
cfe/trunk/test/Analysis/debug-CallGraph.c
Index: cfe/trunk/test/Analysis/debug-CallGraph.c
===================================================================
--- cfe/trunk/test/Analysis/debug-CallGraph.c
+++ cfe/trunk/test/Analysis/debug-CallGraph.c
@@ -1,5 +1,17 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCallGraph %s -fblocks 2>&1 | FileCheck %s
+int get5() {
+ return 5;
+}
+
+int add(int val1, int val2) {
+ return val1 + val2;
+}
+
+int test_add() {
+ return add(10, get5());
+}
+
static void mmm(int y) {
if (y != 0)
y++;
@@ -32,7 +44,7 @@
void fff() { eee(); }
// CHECK:--- Call graph Dump ---
-// CHECK-NEXT: {{Function: < root > calls: mmm foo aaa < > bbb ccc ddd eee fff $}}
+// CHECK-NEXT: {{Function: < root > calls: get5 add test_add mmm foo aaa < > bbb ccc ddd eee fff $}}
// CHECK-NEXT: {{Function: fff calls: eee $}}
// CHECK-NEXT: {{Function: eee calls: $}}
// CHECK-NEXT: {{Function: ddd calls: ccc $}}
@@ -42,3 +54,6 @@
// CHECK-NEXT: {{Function: aaa calls: foo $}}
// CHECK-NEXT: {{Function: foo calls: mmm $}}
// CHECK-NEXT: {{Function: mmm calls: $}}
+// CHECK-NEXT: {{Function: test_add calls: add get5 $}}
+// CHECK-NEXT: {{Function: add calls: $}}
+// CHECK-NEXT: {{Function: get5 calls: $}}
Index: cfe/trunk/lib/Analysis/CallGraph.cpp
===================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp
+++ cfe/trunk/lib/Analysis/CallGraph.cpp
@@ -62,6 +62,7 @@
void VisitCallExpr(CallExpr *CE) {
if (Decl *D = getDeclFromCall(CE))
addCalledDecl(D);
+ VisitChildren(CE);
}
// Adds may-call edges for the ObjC message sends.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28905.86041.patch
Type: text/x-patch
Size: 1620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170127/872227b2/attachment.bin>
More information about the cfe-commits
mailing list