Hi,<br> <br>would anybody help me to handle directives file parsing AST.<br><br>I have tried the following, but it does not help:<br><br>llvm_include_handler* h = new llvm_include_handler;<br>m_preprocessor->addPPCallbacks(h); // m_preprocessor is type of clang::Preprocessor*<br>
<br>where llvm_include_handler is defined as:<br><br>class llvm_include_handler :<br> public clang::PPCallbacks<br>{<br>public:<br> virtual void InclusionDirective(clang::SourceLocation,<br> const clang::Token& ,<br>
llvm::StringRef FileName,<br> bool IsAngled,<br> const clang::FileEntry*,<br> clang::SourceLocation,<br> llvm::StringRef SearchPath,<br> llvm::StringRef RelativePath)<br> {<br>
std::cout << "include "<< std::endl;<br> std::cout << FileName.str() << std::endl;<br> std::cout << "IsAngled " << IsAngled << std::endl;<br>
std::cout << SearchPath.str() << std::endl;<br> std::cout << RelativePath.str() << std::endl;<br> }<br><br> virtual ~llvm_include_handler() throw()<br>
{}<br>};<br><br>than I call clang::ParseAST() to parse the AST nodes with my ASTConsumer. The InclusionDirective is not called.<br>What have I missed.<br><br>Thanks,<br>Anna.<br>