class ArgumentsAdjustingCompilations

Declaration

class ArgumentsAdjustingCompilations : public CompilationDatabase { /* full declaration omitted */ };

Description

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.

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:118

Inherits from: CompilationDatabase

Member Variables

private std::unique_ptr<CompilationDatabase> Compilations
private std::vector<ArgumentsAdjuster> Adjusters

Method Overview

Inherited from CompilationDatabase:

Methods

ArgumentsAdjustingCompilations(
    std::unique_ptr<CompilationDatabase>
        Compilations)

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:120

Parameters

std::unique_ptr<CompilationDatabase> Compilations

std::vector<CompileCommand> adjustCommands(
    std::vector<CompileCommand> Commands) const

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:138

Parameters

std::vector<CompileCommand> Commands

void appendArgumentsAdjuster(
    clang::tooling::ArgumentsAdjuster Adjuster)

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:124

Parameters

clang::tooling::ArgumentsAdjuster Adjuster

std::vector<CompileCommand>
getAllCompileCommands() const

Description

Returns all compile commands for all the files in the compilation database. FIXME: Add a layer in Tooling that provides an interface to run a tool over all files in a compilation database. Not all build systems have the ability to provide a feasible implementation for \c getAllCompileCommands. By default, this is implemented in terms of getAllFiles() and getCompileCommands(). Subclasses may override this for efficiency.

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:131

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

Description

Returns the list of all files available in the compilation database. By default, returns nothing. Implementations should override this if they can enumerate their source files.

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:129

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

Description

Returns all compile commands in which the specified file was compiled. This includes compile commands that span multiple source files. For example, consider a project with the following compilations: $ clang++ -o test a.cc b.cc t.cc $ clang++ -o production a.cc b.cc -DPRODUCTION A compilation database representing the project would return both command lines for a.cc and b.cc and only the first command line for t.cc.

Declared at: clang/include/clang/Tooling/CommonOptionsParser.h:127

Parameters

llvm::StringRef FilePath