[cfe-commits] r158934 - /cfe/trunk/include/clang/Analysis/CallGraph.h

Anna Zaks ganna at apple.com
Thu Jun 21 13:36:11 PDT 2012


Author: zaks
Date: Thu Jun 21 15:36:11 2012
New Revision: 158934

URL: http://llvm.org/viewvc/llvm-project?rev=158934&view=rev
Log:
[analyzer] Do not step into statements while collecting function decls.

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.

Modified:
    cfe/trunk/include/clang/Analysis/CallGraph.h

Modified: cfe/trunk/include/clang/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CallGraph.h?rev=158934&r1=158933&r2=158934&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CallGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/CallGraph.h Thu Jun 21 15:36:11 2012
@@ -102,7 +102,8 @@
   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 @@
     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:





More information about the cfe-commits mailing list