[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.

llvm-svn: 158934
This commit is contained in:
Anna Zaks 2012-06-21 20:36:11 +00:00
parent fcf52c8304
commit 0760470371
1 changed files with 5 additions and 1 deletions

View 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: