[clang] a983562 - Precommit test for clang::CallGraph declared functions.

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 12:00:50 PDT 2020


Author: Erich Keane
Date: 2020-03-19T12:00:30-07:00
New Revision: a983562b23458777a7226ec6cfe41cbeb9d291de

URL: https://github.com/llvm/llvm-project/commit/a983562b23458777a7226ec6cfe41cbeb9d291de
DIFF: https://github.com/llvm/llvm-project/commit/a983562b23458777a7226ec6cfe41cbeb9d291de.diff

LOG: Precommit test for clang::CallGraph declared functions.

https://reviews.llvm.org/D76435 fixes this problem, functions that are
being declared but ARE called aren't entered into the callgraph.

Added: 
    

Modified: 
    clang/test/Analysis/debug-CallGraph.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Analysis/debug-CallGraph.cpp b/clang/test/Analysis/debug-CallGraph.cpp
index 0f5a83b268a0..5453e2f21533 100644
--- a/clang/test/Analysis/debug-CallGraph.cpp
+++ b/clang/test/Analysis/debug-CallGraph.cpp
@@ -81,8 +81,26 @@ namespace Lambdas {
   }
 }
 
+namespace CallDecl {
+  void SomeDecl();
+  void SomeOtherDecl();
+  void SomeDef() {}
+
+  void Caller() {
+    SomeDecl();
+    SomeOtherDecl();
+  }
+
+  void SomeOtherDecl() {
+    SomeDef();
+  }
+}
+
 // 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 SomeNS::templ SomeNS::templ SomeNS::templUser Lambdas::Callee Lambdas::f1 Lambdas::f1\(\)::\(anonymous class\)::operator\(\) Lambdas::f1\(\)::\(anonymous class\)::operator\(\) $}}
+// 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 Lambdas::Callee Lambdas::f1 Lambdas::f1\(\)::\(anonymous class\)::operator\(\) Lambdas::f1\(\)::\(anonymous class\)::operator\(\) CallDecl::SomeDef CallDecl::Caller CallDecl::SomeOtherDecl $}}
+// CHECK-NEXT: {{Function: CallDecl::Caller calls: CallDecl::SomeOtherDecl $}}
+// CHECK-NEXT: {{Function: CallDecl::SomeOtherDecl calls: CallDecl::SomeDef $}}
+// CHECK-NEXT: {{Function: CallDecl::SomeDef calls: $}}
 // CHECK-NEXT: {{Function: Lambdas::f1 calls: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) Lambdas::f1\(\)::\(anonymous class\)::operator\(\) $}}
 // CHECK-NEXT: {{Function: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) calls: Lambdas::Callee $}}
 // CHECK-NEXT: {{Function: Lambdas::f1\(\)::\(anonymous class\)::operator\(\) calls: Lambdas::Callee $}}


        


More information about the cfe-commits mailing list