clang 8.0.0

Public Member Functions | List of all members
clang::tooling::ArgumentsAdjustingCompilations Class Reference

`#include "clang/Tooling/CommonOptionsParser.h"`

Inheritance diagram for clang::tooling::ArgumentsAdjustingCompilations:
[legend]
Collaboration diagram for clang::tooling::ArgumentsAdjustingCompilations:
[legend]

## Public Member Functions
| ArgumentsAdjustingCompilations (std::unique_ptr< CompilationDatabase > Compilations)
void | appendArgumentsAdjuster (ArgumentsAdjuster Adjuster)
std::vector< CompileCommand > | getCompileCommands (StringRef FilePath) const override
| Returns all compile commands in which the specified file was compiled. More...
std::vector< std::string > | getAllFiles () const override
| Returns the list of all files available in the compilation database. More...
std::vector< CompileCommand > | getAllCompileCommands () const override
| Returns all compile commands for all the files in the compilation database. More...
Public Member Functions inherited from clang::tooling::CompilationDatabase
virtual | ~CompilationDatabase ()

## Additional Inherited Members
Static Public Member Functions inherited from clang::tooling::CompilationDatabase
static std::unique_ptr< CompilationDatabase > | loadFromDirectory (StringRef BuildDirectory, std::string &ErrorMessage)
| Loads a compilation database from a build directory. More...
static std::unique_ptr< CompilationDatabase > | autoDetectFromSource (StringRef SourceFile, std::string &ErrorMessage)
| Tries to detect a compilation database location and load it. More...
static std::unique_ptr< CompilationDatabase > | autoDetectFromDirectory (StringRef SourceDir, std::string &ErrorMessage)
| Tries to detect a compilation database location and load it. More...

## Detailed Description

Definition at line 131 of file CommonOptionsParser.h.

## Constructor & Destructor Documentation

## ◆ ArgumentsAdjustingCompilations()

clang::tooling::ArgumentsAdjustingCompilations::ArgumentsAdjustingCompilations | ( | std::unique_ptr< CompilationDatabase > | Compilations | ) |
| inline

Definition at line 133 of file CommonOptionsParser.h.

## Member Function Documentation

## ◆ appendArgumentsAdjuster()

void ArgumentsAdjustingCompilations::appendArgumentsAdjuster | ( | ArgumentsAdjuster | Adjuster | ) |

Definition at line 56 of file CommonOptionsParser.cpp.

## ◆ getAllCompileCommands()

std::vector< CompileCommand > ArgumentsAdjustingCompilations::getAllCompileCommands | ( |  | ) | const
| override virtual

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 `getAllCompileCommands`.

By default, this is implemented in terms of getAllFiles() and getCompileCommands(). Subclasses may override this for efficiency.

Reimplemented from clang::tooling::CompilationDatabase.

Definition at line 72 of file CommonOptionsParser.cpp.

References clang::tooling::CompilationDatabase::autoDetectFromDirectory(), clang::tooling::CompilationDatabase::autoDetectFromSource(), clang::tooling::BEGIN, Category, clang::tooling::combineAdjusters(), clang::tooling::END, clang::Error, clang::tooling::getInsertArgumentAdjuster(), and clang::tooling::FixedCompilationDatabase::loadFromCommandLine().

## ◆ getAllFiles()

std::vector< std::string > ArgumentsAdjustingCompilations::getAllFiles | ( |  | ) | const
| override virtual

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.

Reimplemented from clang::tooling::CompilationDatabase.

Definition at line 67 of file CommonOptionsParser.cpp.

## ◆ getCompileCommands()

std::vector< CompileCommand > ArgumentsAdjustingCompilations::getCompileCommands | ( | StringRef | FilePath | ) | const
| override virtual

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.

Implements clang::tooling::CompilationDatabase.

Definition at line 61 of file CommonOptionsParser.cpp.

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

- include/clang/Tooling/CommonOptionsParser.h
- lib/Tooling/CommonOptionsParser.cpp