clang: clang::tooling::CompilationDatabase Class Reference (original) (raw)
Interface for compilation databases. More...
#include "[clang/Tooling/CompilationDatabase.h](CompilationDatabase%5F8h%5Fsource.html)"
Public Member Functions | |
---|---|
virtual | ~CompilationDatabase () |
virtual std::vector< CompileCommand > | getCompileCommands (StringRef FilePath) const =0 |
Returns all compile commands in which the specified file was compiled. | |
virtual std::vector< std::string > | getAllFiles () const |
Returns the list of all files available in the compilation database. | |
virtual std::vector< CompileCommand > | getAllCompileCommands () const |
Returns all compile commands for all the files in the compilation database. | |
Static Public Member Functions | |
---|---|
static std::unique_ptr< CompilationDatabase > | loadFromDirectory (StringRef BuildDirectory, std::string &ErrorMessage) |
Loads a compilation database from a build directory. | |
static std::unique_ptr< CompilationDatabase > | autoDetectFromSource (StringRef SourceFile, std::string &ErrorMessage) |
Tries to detect a compilation database location and load it. | |
static std::unique_ptr< CompilationDatabase > | autoDetectFromDirectory (StringRef SourceDir, std::string &ErrorMessage) |
Tries to detect a compilation database location and load it. | |
Interface for compilation databases.
A compilation database allows the user to retrieve compile command lines for the files in a project.
Many implementations are enumerable, allowing all command lines to be retrieved. These can be used to run clang tools over a subset of the files in a project.
Definition at line 87 of file CompilationDatabase.h.
CompilationDatabase::~CompilationDatabase ( ) | virtualdefault |
---|
◆ autoDetectFromDirectory()
std::unique_ptr< CompilationDatabase > CompilationDatabase::autoDetectFromDirectory ( StringRef SourceDir, std::string & ErrorMessage ) | static |
---|
◆ autoDetectFromSource()
std::unique_ptr< CompilationDatabase > CompilationDatabase::autoDetectFromSource ( StringRef SourceFile, std::string & ErrorMessage ) | static |
---|
◆ getAllCompileCommands()
std::vector< CompileCommand > CompilationDatabase::getAllCompileCommands ( ) const | virtual |
---|
◆ getAllFiles()
virtual std::vector< std::string > clang::tooling::CompilationDatabase::getAllFiles ( ) const | inlinevirtual |
---|
◆ getCompileCommands()
virtual std::vector< CompileCommand > clang::tooling::CompilationDatabase::getCompileCommands ( StringRef FilePath) const | pure virtual |
---|
◆ loadFromDirectory()
std::unique_ptr< CompilationDatabase > CompilationDatabase::loadFromDirectory ( StringRef BuildDirectory, std::string & ErrorMessage ) | static |
---|
Loads a compilation database from a build directory.
Looks at the specified 'BuildDirectory' and creates a compilation database that allows to query compile commands for source files in the corresponding source tree.
Returns NULL and sets ErrorMessage if we were not able to build up a compilation database for the build directory.
FIXME: Currently only supports JSON compilation databases, which are named 'compile_commands.json' in the given directory. Extend this for other build types (like ninja build files).
Definition at line 64 of file CompilationDatabase.cpp.
Referenced by findCompilationDatabaseFromDirectory().
The documentation for this class was generated from the following files:
- include/clang/Tooling/CompilationDatabase.h
- lib/Tooling/CompilationDatabase.cpp