clang-tools 8.0.0

Public Member Functions | List of all members
clang::clangd::OverlayCDB Class Reference

Wraps another compilation database, and supports overriding the commands using an in-memory mapping. More...

`#include <GlobalCompilationDatabase.h>`

Inheritance diagram for clang::clangd::OverlayCDB:
[legend]
Collaboration diagram for clang::clangd::OverlayCDB:
[legend]

## Public Member Functions
| OverlayCDB (const GlobalCompilationDatabase *Base, std::vector< std::string > FallbackFlags={}, llvm::Optional< std::string > ResourceDir=llvm::None)
llvm::Optional< tooling::CompileCommand > | getCompileCommand (PathRef File, ProjectInfo *=nullptr) const override
| If there are any known-good commands for building this file, returns one. More...
tooling::CompileCommand | getFallbackCommand (PathRef File) const override
| Makes a guess at how to build a file. More...
void | setCompileCommand (PathRef File, llvm::Optional< tooling::CompileCommand > CompilationCommand)
| Sets or clears the compilation command for a particular file. More...
Public Member Functions inherited from clang::clangd::GlobalCompilationDatabase
virtual | ~GlobalCompilationDatabase ()=default
CommandChanged::Subscription | watch (CommandChanged::Listener L) const
| The callback is notified when files may have new compile commands. More...

## Additional Inherited Members
Public Types inherited from clang::clangd::GlobalCompilationDatabase
using | CommandChanged = Event< std::vector< std::string > >
Protected Attributes inherited from clang::clangd::GlobalCompilationDatabase
CommandChanged | OnCommandChanged

## Detailed Description

Wraps another compilation database, and supports overriding the commands using an in-memory mapping.

Definition at line 97 of file GlobalCompilationDatabase.h.

## Constructor & Destructor Documentation

## ◆ OverlayCDB()

clang::clangd::OverlayCDB::OverlayCDB | ( | const GlobalCompilationDatabase * | Base,
|  | std::vector< std::string > | FallbackFlags = `{}`,
|  | llvm::Optional< std::string > | ResourceDir = `llvm::None`
| ) |  |

Definition at line 132 of file GlobalCompilationDatabase.cpp.

References clang::clangd::Event< T >::broadcast(), clang::clangd::GlobalCompilationDatabase::OnCommandChanged, and clang::clangd::GlobalCompilationDatabase::watch().

## Member Function Documentation

## ◆ getCompileCommand()

llvm::Optional< tooling::CompileCommand > clang::clangd::OverlayCDB::getCompileCommand | ( | PathRef | File,
|  | ProjectInfo * | = `nullptr`
| ) |  | const
| override virtual

If there are any known-good commands for building this file, returns one.

If the ProjectInfo pointer is set, it will also be populated.

Implements clang::clangd::GlobalCompilationDatabase.

Definition at line 145 of file GlobalCompilationDatabase.cpp.

## ◆ getFallbackCommand()

tooling::CompileCommand clang::clangd::OverlayCDB::getFallbackCommand | ( | PathRef | File | ) | const
| override virtual

Makes a guess at how to build a file.

The default implementation just runs clang on the file. Clangd should treat the results as unreliable.

Reimplemented from clang::clangd::GlobalCompilationDatabase.

Definition at line 164 of file GlobalCompilationDatabase.cpp.

References clang::clangd::GlobalCompilationDatabase::getFallbackCommand().

## ◆ setCompileCommand()

void clang::clangd::OverlayCDB::setCompileCommand | ( | PathRef | File,
|  | llvm::Optional< tooling::CompileCommand > | CompilationCommand
| ) |  |

Sets or clears the compilation command for a particular file.

Definition at line 173 of file GlobalCompilationDatabase.cpp.

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

- GlobalCompilationDatabase.h
- GlobalCompilationDatabase.cpp