[PATCH] Introduce ClangTool::buildASTs, and buildASTFromCode.

Peter Collingbourne peter at pcc.me.uk
Sun Nov 3 22:30:25 PST 2013


Hi klimek,

These allow clients to retrieve persistent AST objects (ASTUnits) which
can be used in an ad-hoc manner after parsing.

To accommodate this change, the code for processing a CompilerInvocation
using a FrontendAction has been factored out to FrontendActionFactory, and
a new base class, ToolAction, has been introduced, allowing the tool to do
arbitrary things with each CompilerInvocation.  This change was necessary
because ASTUnit does not use the FrontendAction interface directly.

This change also causes the FileManager in ClangTool to use shared ownership.
This will become necessary because ASTUnit takes shared ownership of
FileManager (ClangTool's FileManager is currently unused by ASTUnit; this
is a FIXME).  As shown in the tests, any client of ToolInvocation will
need to be modified to use shared ownership for FileManager.

http://llvm-reviews.chandlerc.com/D2097

Files:
  include/clang/Tooling/Tooling.h
  lib/Tooling/Tooling.cpp
  unittests/Tooling/ToolingTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2097.1.patch
Type: text/x-patch
Size: 17598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131103/c84797ae/attachment.bin>


More information about the cfe-commits mailing list