]> granicus.if.org Git - clang/commitdiff
[analyzer] Do not step into statements while collecting function decls.
authorAnna Zaks <ganna@apple.com>
Thu, 21 Jun 2012 20:36:11 +0000 (20:36 +0000)
committerAnna Zaks <ganna@apple.com>
Thu, 21 Jun 2012 20:36:11 +0000 (20:36 +0000)
CallGraph's recursive visitor only needs to collect declarations; their
bodies will be processed later on. RecursiveASTVisitor will recurse on
the bodies if the definition is provided along with declaration.
Optimize, by not recursing on any of the statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158934 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/CallGraph.h

index 81afec0827bc86171166d154a3179a6fd80f7c47..509de7bc2178008e96b301524243ec746cc86226 100644 (file)
@@ -102,7 +102,8 @@ public:
   void dump() const;
   void viewGraph() const;
 
-  /// Part of recursive declaration visitation.
+  /// Part of recursive declaration visitation. We recursively visit all the
+  /// Declarations to collect the root functions.
   bool VisitFunctionDecl(FunctionDecl *FD) {
     // We skip function template definitions, as their semantics is
     // only determined when they are instantiated.
@@ -121,6 +122,9 @@ public:
     return true;
   }
 
+  // We are only collecting the declarations, so do not step into the bodies.
+  bool TraverseStmt(Stmt *S) { return true; }
+
   bool shouldWalkTypesOfTypeLocs() const { return false; }
 
 private: