<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi all,<br><br>I am implementing two clang actions derived from the class clang::PluginASTAction.<br>First tool analyzes the translation unit and modifies it.<br>Second tool extracts from the modified translation unit.<br><br>The second tool is able to extract the function declarations onto separate files, but I cannot get the modified translation unit from the first tool. It extracts from the original translation unit.<br><br>First tool creates<br>* class FirstConsumer : public clang::ASTConsumer<br>and second tool creates<br>* class SecondConsumer : public clang::ASTConsumer<br><br>First consumer class modifies function attributes:<br>* void FirstConsumer::HandleFunctionDecl(FunctionDecl *FD)<br>* {<br>*     ......<br>*     FD->addAttr(::new (*context) PureAttr(FD->getLocation(),
 *context));<br>*     ......<br>* }<br><br>Second consumer class checks function attributes:<br>* void SecondConsumer::HandleFunctionDecl(const FunctionDecl *FD)<br>* {<br>*    .....<br>*    for (Decl::attr_iterator AI = FD->attr_begin(),<br>*           AE = FD->attr_end(); AI != AE; AI++) {<br>*         if (PureAttr::classof(*AI))<br>*             llvm::errs() << "Pure Function\n";<br>*     }<br>*    .....<br>* }<br><br>The second tool does not see the modified version of the FunctionDecl. If I include the attribute check into the first tool, the tool gets new attribute information, but I would like to have two tools where one modifies the function and second one checks it.<br><br>Can anyone tell me if there is a way to do that?<br><br>I create the actions in this
 way in the driver:<br>* ....<br>* llvm::OwningPtr<FirstAction> firstact(new FirstAction);<br>* Clang.ExecuteAction(*firstact);<br>* llvm::OwningPtr<SecondAction> secondact(new SecondAction);<br>* Clang.ExecuteAction(*secondact);<br>* .....<br><br>Thanks for your help in advance!<br>Murat<br></td></tr></table><br>