I have the following recursive AST visitor implementation.
class ExampleVisitor : public clang::RecursiveASTVisitor<ExampleVisitor>{
private:
clang::ASTContext* ast_context_; // used for getting additional AST info
public:
explicit ExampleVisitor(clang::CompilerInstance* ci)
: ast_context_(&(ci->getASTContext())) // initialize private members
virtual bool VisitFunctionDecl(clang::FunctionDecl* func)
{
numFunctions++;
foo(func);
return true;
}};
The function foo prints the names of the declared functions for a given input file.
In this implementation foo prints the functions that are declared in the input file as well as dumps all function declarations from the included header files. How can I modify this code to print only the functions declared in the given input file?