]> granicus.if.org Git - clang/commit
Introduce ClangTool::buildASTs, and buildASTFromCode.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Nov 2013 20:12:45 +0000 (20:12 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Nov 2013 20:12:45 +0000 (20:12 +0000)
commit8051db16aa9513333062ab3145f038429f66780f
tree75eb3a5d3f092126ec8bceb1656390cd9d50c7c1
parent298028994ea4dae826422c15139682b82197a35e
Introduce ClangTool::buildASTs, and buildASTFromCode.

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.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194164 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Tooling/Tooling.h
lib/Tooling/Tooling.cpp
unittests/Tooling/ToolingTest.cpp