[cfe-dev] Accessing ASTContext after run() invocation

Pardis Pashakhanloo via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 9 07:48:01 PST 2018


Hi all,

Suppose we have created a ClangTool in libtooling.
Is there a way to record ASTContexts (say, in the consumer), and access
them after clangTool.run(...)?

For example:

std::vector<ASTContext*> contexts;
int main(int argc, char **argv) {

  CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);

  ClangTool Tool(OptionsParser.getCompilations(),

    OptionsParser.getSourcePathList());

  Tool.run(newFrontendActionFactory<MyAction>().get());

     // I want to access contexts[i] here and possibly use the rewriter.
}

Any help is appreciated.

Thanks,
Pardis P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181109/574cf97a/attachment.html>


More information about the cfe-dev mailing list