<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">Hi all,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">Suppose we have created a ClangTool in libtooling.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">Is there a way to record ASTContexts (say, in the consumer), and access them after clangTool.run(...)?</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">For example:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">std::vector<ASTContext*> contexts;</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">int main(int argc, char **argv) {</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">  CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">  ClangTool Tool(OptionsParser.getCompilations(),</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">    OptionsParser.getSourcePathList());</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">  Tool.run(newFrontendActionFactory<MyAction>().get());</span></p></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">     // I want to access contexts[i] here and possibly use the rewriter.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">}</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444">Any help is appreciated.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#444444"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(68,68,68)">Thanks,</span></div><div><span style="color:rgb(68,68,68);font-family:tahoma,sans-serif"><span class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(68,68,68)">Pardis P</span></span></div></div></div></div>