clang 20.0.0git
Classes | Namespaces | Typedefs | Functions
Tooling.h File Reference
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LLVM.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/PCHContainerOperations.h"
#include "clang/Tooling/ArgumentsAdjusters.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  clang::tooling::ToolAction
 Interface to process a clang::CompilerInvocation. More...
 
class  clang::tooling::FrontendActionFactory
 Interface to generate clang::FrontendActions. More...
 
class  clang::tooling::SourceFileCallbacks
 Callbacks called before and after each source file processed by a FrontendAction created by the FrontedActionFactory returned by newFrontendActionFactory. More...
 
class  clang::tooling::ToolInvocation
 Utility to run a FrontendAction in a single clang invocation. More...
 
class  clang::tooling::ClangTool
 Utility to run a FrontendAction over a set of files. More...
 

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
 
namespace  clang::driver
 
namespace  clang::tooling
 

Typedefs

using clang::tooling::FileContentMappings = std::vector< std::pair< std::string, std::string > >
 The first part of the pair is the filename, the second part the file-content.
 

Functions

const llvm::opt::ArgStringList * clang::tooling::getCC1Arguments (DiagnosticsEngine *Diagnostics, driver::Compilation *Compilation)
 Retrieves the flags of the -cc1 job in Compilation that has only source files as its inputs.
 
template<typename T >
std::unique_ptr< FrontendActionFactory > clang::tooling::newFrontendActionFactory ()
 Returns a new FrontendActionFactory for a given type.
 
template<typename FactoryT >
std::unique_ptr< FrontendActionFactory > clang::tooling::newFrontendActionFactory (FactoryT *ConsumerFactory, SourceFileCallbacks *Callbacks=nullptr)
 Returns a new FrontendActionFactory for any type that provides an implementation of newASTConsumer().
 
bool clang::tooling::runToolOnCode (std::unique_ptr< FrontendAction > ToolAction, const Twine &Code, const Twine &FileName="input.cc", std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >())
 Runs (and deletes) the tool on 'Code' with the -fsyntax-only flag.
 
bool clang::tooling::runToolOnCodeWithArgs (std::unique_ptr< FrontendAction > ToolAction, const Twine &Code, const std::vector< std::string > &Args, const Twine &FileName="input.cc", const Twine &ToolName="clang-tool", std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), const FileContentMappings &VirtualMappedFiles=FileContentMappings())
 Runs (and deletes) the tool on 'Code' with the -fsyntax-only flag and with additional other flags.
 
bool clang::tooling::runToolOnCodeWithArgs (std::unique_ptr< FrontendAction > ToolAction, const Twine &Code, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, const std::vector< std::string > &Args, const Twine &FileName="input.cc", const Twine &ToolName="clang-tool", std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >())
 
std::unique_ptr< ASTUnitclang::tooling::buildASTFromCode (StringRef Code, StringRef FileName="input.cc", std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >())
 Builds an AST for 'Code'.
 
std::unique_ptr< ASTUnitclang::tooling::buildASTFromCodeWithArgs (StringRef Code, const std::vector< std::string > &Args, StringRef FileName="input.cc", StringRef ToolName="clang-tool", std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), ArgumentsAdjuster Adjuster=getClangStripDependencyFileAdjuster(), const FileContentMappings &VirtualMappedFiles=FileContentMappings(), DiagnosticConsumer *DiagConsumer=nullptr)
 Builds an AST for 'Code' with additional flags.
 
std::string clang::tooling::getAbsolutePath (StringRef File)
 Returns the absolute path of File, by prepending it with the current directory if File is not absolute.
 
llvm::Expected< std::string > clang::tooling::getAbsolutePath (llvm::vfs::FileSystem &FS, StringRef File)
 An overload of getAbsolutePath that works over the provided FS.
 
void clang::tooling::addTargetAndModeForProgramName (std::vector< std::string > &CommandLine, StringRef InvokedAs)
 Changes CommandLine to contain implicit flags that would have been defined had the compiler driver been invoked through the path InvokedAs.
 
void clang::tooling::addExpandedResponseFiles (std::vector< std::string > &CommandLine, llvm::StringRef WorkingDir, llvm::cl::TokenizerCallback Tokenizer, llvm::vfs::FileSystem &FS)
 Helper function that expands response files in command line.
 
CompilerInvocationclang::tooling::newInvocation (DiagnosticsEngine *Diagnostics, ArrayRef< const char * > CC1Args, const char *const BinaryName)
 Creates a CompilerInvocation.