Author: erichkeane Date: Wed Dec 12 10:11:36 2018 New Revision: 348950 URL: http://llvm.org/viewvc/llvm-project?rev=348950&view=rev Log: 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 Modified: cfe/trunk/lib/Analysis/CallGraph.cpp cfe/trunk/test/Analysis/debug-CallGraph.cpp Modified: cfe/trunk/lib/Analysis/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CallGraph.cpp?rev=348950&r1=348949&r2=348950&view=diff ============================================================================== --- cfe/trunk/lib/Analysis/CallGraph.cpp (original) +++ cfe/trunk/lib/Analysis/CallGraph.cpp Wed Dec 12 10:11:36 2018 @@ -212,7 +212,7 @@ void CallGraph::viewGraph() const { void CallGraphNode::print(raw_ostream &os) const { if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(FD)) - return ND->printName(os); + return ND->printQualifiedName(os); os << "< >"; } Modified: cfe/trunk/test/Analysis/debug-CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/debug-CallGraph.cpp?rev=348950&r1=348949&r2=348950&view=diff ============================================================================== --- cfe/trunk/test/Analysis/debug-CallGraph.cpp (original) +++ cfe/trunk/test/Analysis/debug-CallGraph.cpp Wed Dec 12 10:11:36 2018 @@ -51,6 +51,7 @@ void test_single_call() { do_nothing(); } +namespace SomeNS { template<typename T> void templ(T t) { ccc(); @@ -61,17 +62,17 @@ void templ<double>(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 $}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits