clang 19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::tooling::JSONCompilationDatabase Class Reference

#include "clang/Tooling/JSONCompilationDatabase.h"

Inheritance diagram for clang::tooling::JSONCompilationDatabase:
Inheritance graph
[legend]

Public Member Functions

std::vector< CompileCommandgetCompileCommands (StringRef FilePath) const override
 Returns all compile commands in which the specified file was compiled.
 
std::vector< std::string > getAllFiles () const override
 Returns the list of all files available in the compilation database.
 
std::vector< CompileCommandgetAllCompileCommands () const override
 Returns all compile commands for all the files in the compilation database.
 
- Public Member Functions inherited from clang::tooling::CompilationDatabase
virtual ~CompilationDatabase ()
 
virtual std::vector< CompileCommandgetCompileCommands (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< CompileCommandgetAllCompileCommands () const
 Returns all compile commands for all the files in the compilation database.
 

Static Public Member Functions

static std::unique_ptr< JSONCompilationDatabaseloadFromFile (StringRef FilePath, std::string &ErrorMessage, JSONCommandLineSyntax Syntax)
 Loads a JSON compilation database from the specified file.
 
static std::unique_ptr< JSONCompilationDatabaseloadFromBuffer (StringRef DatabaseString, std::string &ErrorMessage, JSONCommandLineSyntax Syntax)
 Loads a JSON compilation database from a data buffer.
 
- Static Public Member Functions inherited from clang::tooling::CompilationDatabase
static std::unique_ptr< CompilationDatabaseloadFromDirectory (StringRef BuildDirectory, std::string &ErrorMessage)
 Loads a compilation database from a build directory.
 
static std::unique_ptr< CompilationDatabaseautoDetectFromSource (StringRef SourceFile, std::string &ErrorMessage)
 Tries to detect a compilation database location and load it.
 
static std::unique_ptr< CompilationDatabaseautoDetectFromDirectory (StringRef SourceDir, std::string &ErrorMessage)
 Tries to detect a compilation database location and load it.
 

Detailed Description

Definition at line 61 of file JSONCompilationDatabase.h.

Member Function Documentation

◆ getAllCompileCommands()

std::vector< CompileCommand > JSONCompilationDatabase::getAllCompileCommands ( ) const
overridevirtual

Returns all compile commands for all the files in the compilation database.

Reimplemented from clang::tooling::CompilationDatabase.

Definition at line 252 of file JSONCompilationDatabase.cpp.

◆ getAllFiles()

std::vector< std::string > JSONCompilationDatabase::getAllFiles ( ) const
overridevirtual

Returns the list of all files available in the compilation database.

These are the 'file' entries of the JSON objects.

Reimplemented from clang::tooling::CompilationDatabase.

Definition at line 244 of file JSONCompilationDatabase.cpp.

References clang::Result.

◆ getCompileCommands()

std::vector< CompileCommand > JSONCompilationDatabase::getCompileCommands ( StringRef  FilePath) const
overridevirtual

Returns all compile commands in which the specified file was compiled.

FIXME: Currently FilePath must be an absolute path inside the source directory which does not have symlinks resolved.

Implements clang::tooling::CompilationDatabase.

Definition at line 226 of file JSONCompilationDatabase.cpp.

References clang::tooling::FileMatchTrie::findEquivalent().

◆ loadFromBuffer()

std::unique_ptr< JSONCompilationDatabase > JSONCompilationDatabase::loadFromBuffer ( StringRef  DatabaseString,
std::string &  ErrorMessage,
JSONCommandLineSyntax  Syntax 
)
static

Loads a JSON compilation database from a data buffer.

Returns NULL and sets ErrorMessage if the database could not be loaded.

Definition at line 213 of file JSONCompilationDatabase.cpp.

◆ loadFromFile()

std::unique_ptr< JSONCompilationDatabase > JSONCompilationDatabase::loadFromFile ( StringRef  FilePath,
std::string &  ErrorMessage,
JSONCommandLineSyntax  Syntax 
)
static

Loads a JSON compilation database from the specified file.

Returns NULL and sets ErrorMessage if the database could not be loaded from the given file.

Definition at line 193 of file JSONCompilationDatabase.cpp.

References clang::Result.


The documentation for this class was generated from the following files: