From 1c106b9cc9139bd49c1297cc9da4966b0c703cec Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Wed, 12 Dec 2018 18:11:36 +0000 Subject: [PATCH] Change CallGraph print to show the fully qualified name CallGraph previously would just show the normal name of a function, which gets really confusing when using it on large C++ projects. This patch switches the printName call to a printQualifiedName, so that the namespaces are included. Change-Id: Ie086d863f6b2251be92109ea1b0946825b28b49a git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348950 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CallGraph.cpp | 2 +- test/Analysis/debug-CallGraph.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Analysis/CallGraph.cpp b/lib/Analysis/CallGraph.cpp index bac00680ff..66a6f1a9bc 100644 --- a/lib/Analysis/CallGraph.cpp +++ b/lib/Analysis/CallGraph.cpp @@ -212,7 +212,7 @@ void CallGraph::viewGraph() const { void CallGraphNode::print(raw_ostream &os) const { if (const NamedDecl *ND = dyn_cast_or_null(FD)) - return ND->printName(os); + return ND->printQualifiedName(os); os << "< >"; } diff --git a/test/Analysis/debug-CallGraph.cpp b/test/Analysis/debug-CallGraph.cpp index 7f9ee4dc94..1d6844fad9 100644 --- a/test/Analysis/debug-CallGraph.cpp +++ b/test/Analysis/debug-CallGraph.cpp @@ -51,6 +51,7 @@ void test_single_call() { do_nothing(); } +namespace SomeNS { template void templ(T t) { ccc(); @@ -61,17 +62,17 @@ void templ(double t) { eee(); } - void templUser() { templ(5); templ(5.5); } +} // CHECK:--- Call graph Dump --- -// CHECK-NEXT: {{Function: < root > calls: get5 add test_add mmm foo aaa < > bbb ddd ccc eee fff do_nothing test_single_call templ templ templUser $}} -// CHECK-NEXT: {{Function: templUser calls: templ templ $}} -// CHECK-NEXT: {{Function: templ calls: eee $}} -// CHECK-NEXT: {{Function: templ calls: ccc $}} +// 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 $}} +// CHECK-NEXT: {{Function: SomeNS::templUser calls: SomeNS::templ SomeNS::templ $}} +// CHECK-NEXT: {{Function: SomeNS::templ calls: eee $}} +// CHECK-NEXT: {{Function: SomeNS::templ calls: ccc $}} // CHECK-NEXT: {{Function: test_single_call calls: do_nothing $}} // CHECK-NEXT: {{Function: do_nothing calls: $}} // CHECK-NEXT: {{Function: fff calls: eee $}} -- 2.50.1