30 #ifndef LLVM_CLANG_TOOLING_TOOLING_H
31 #define LLVM_CLANG_TOOLING_TOOLING_H
43 #include "llvm/ADT/StringMap.h"
44 #include "llvm/ADT/Twine.h"
45 #include "llvm/Option/Option.h"
56 class CompilerInvocation;
73 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
89 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
105 template <
typename T>
137 template <
typename FactoryT>
139 FactoryT *ConsumerFactory, SourceFileCallbacks *Callbacks =
nullptr);
151 const Twine &FileName =
"input.cc",
152 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
153 std::make_shared<PCHContainerOperations>());
172 const std::vector<std::string> &Args,
const Twine &FileName =
"input.cc",
173 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
174 std::make_shared<PCHContainerOperations>(),
185 std::unique_ptr<ASTUnit>
187 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
188 std::make_shared<PCHContainerOperations>());
200 const Twine &Code,
const std::vector<std::string> &Args,
201 const Twine &FileName =
"input.cc",
202 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
203 std::make_shared<PCHContainerOperations>());
221 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
222 std::make_shared<PCHContainerOperations>());
231 ToolInvocation(std::vector<std::string> CommandLine, ToolAction *Action,
233 std::shared_ptr<PCHContainerOperations> PCHContainerOps);
239 this->DiagConsumer = DiagConsumer;
256 bool runInvocation(
const char *BinaryName,
259 std::shared_ptr<PCHContainerOperations> PCHContainerOps);
261 std::vector<std::string> CommandLine;
265 std::shared_ptr<PCHContainerOperations> PCHContainerOps;
267 llvm::StringMap<StringRef> MappedFileContents;
290 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
291 std::make_shared<PCHContainerOperations>());
297 this->DiagConsumer = DiagConsumer;
331 std::vector<std::string> SourcePaths;
332 std::shared_ptr<PCHContainerOperations> PCHContainerOps;
336 std::vector< std::pair<StringRef, StringRef> > MappedFileContents;
343 template <
typename T>
350 return std::unique_ptr<FrontendActionFactory>(
351 new SimpleFrontendActionFactory);
354 template <
typename FactoryT>
359 explicit FrontendActionFactoryAdapter(FactoryT *ConsumerFactory,
361 : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {}
364 return new ConsumerFactoryAdaptor(ConsumerFactory, Callbacks);
370 ConsumerFactoryAdaptor(FactoryT *ConsumerFactory,
372 : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {}
374 std::unique_ptr<clang::ASTConsumer>
376 return ConsumerFactory->newASTConsumer();
381 StringRef Filename)
override {
388 void EndSourceFileAction()
override {
395 FactoryT *ConsumerFactory;
398 FactoryT *ConsumerFactory;
402 return std::unique_ptr<FrontendActionFactory>(
403 new FrontendActionFactoryAdapter(ConsumerFactory, Callbacks));
423 const llvm::opt::ArgStringList &CC1Args);
428 #endif // LLVM_CLANG_TOOLING_TOOLING_H
Implements support for file system lookup, file system caching, and directory search management...
Defines the clang::FileManager interface and associated types.
Abstract base class for actions which can be performed by the frontend.
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Concrete class used by the front-end to report problems and issues.
virtual bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename)
Callback at the start of processing a single input.
virtual void EndSourceFileAction()
Callback at the end of processing a single input.
Abstract base class to use for AST consumer-based frontend actions.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Helper class for holding the data necessary to invoke the compiler.
Defines the Diagnostic-related interfaces.
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
This class handles loading and caching of source files into memory.