<div>Seems right to me. Are you sure that m_preprocessor is the preprocessor</div><div>used by clang?</div><br><div class="gmail_quote">2011/4/29 Anna Lu <span dir="ltr"><<a href="mailto:annaruben85@gmail.com">annaruben85@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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><font color="#888888">Anna.<br>
</font><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br>