clang-tools 20.0.0git
|
Provides compilation arguments used for parsing C and C++ files. More...
#include <GlobalCompilationDatabase.h>
Public Types | |
using | CommandChanged = Event< std::vector< std::string > > |
Public Member Functions | |
virtual | ~GlobalCompilationDatabase ()=default |
virtual std::optional< tooling::CompileCommand > | getCompileCommand (PathRef File) const =0 |
If there are any known-good commands for building this file, returns one. | |
virtual std::optional< ProjectInfo > | getProjectInfo (PathRef File) const |
Finds the closest project to File . | |
virtual std::unique_ptr< ProjectModules > | getProjectModules (PathRef File) const |
Get the modules in the closest project to File . | |
virtual tooling::CompileCommand | getFallbackCommand (PathRef File) const |
Makes a guess at how to build a file. | |
virtual bool | blockUntilIdle (Deadline D) const |
If the CDB does any asynchronous work, wait for it to complete. | |
CommandChanged::Subscription | watch (CommandChanged::Listener L) const |
The callback is notified when files may have new compile commands. | |
Protected Attributes | |
CommandChanged | OnCommandChanged |
Provides compilation arguments used for parsing C and C++ files.
Definition at line 36 of file GlobalCompilationDatabase.h.
using clang::clangd::GlobalCompilationDatabase::CommandChanged = Event<std::vector<std::string> > |
Definition at line 64 of file GlobalCompilationDatabase.h.
|
virtualdefault |
|
inlinevirtual |
If the CDB does any asynchronous work, wait for it to complete.
For use in tests.
Reimplemented in clang::clangd::DelegatingCDB, and clang::clangd::DirectoryBasedGlobalCompilationDatabase.
Definition at line 62 of file GlobalCompilationDatabase.h.
Referenced by clang::clangd::DelegatingCDB::blockUntilIdle().
|
pure virtual |
If there are any known-good commands for building this file, returns one.
Implemented in clang::clangd::DelegatingCDB, clang::clangd::DirectoryBasedGlobalCompilationDatabase, clang::clangd::OverlayCDB, and clang::clangd::MockCompilationDatabase.
Referenced by clang::clangd::DelegatingCDB::getCompileCommand().
|
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 in clang::clangd::DelegatingCDB, and clang::clangd::OverlayCDB.
Definition at line 58 of file GlobalCompilationDatabase.cpp.
References clang::clangd::File.
Referenced by clang::clangd::DelegatingCDB::getFallbackCommand().
|
inlinevirtual |
Finds the closest project to File
.
Reimplemented in clang::clangd::DelegatingCDB, clang::clangd::DirectoryBasedGlobalCompilationDatabase, and clang::clangd::MockCompilationDatabase.
Definition at line 45 of file GlobalCompilationDatabase.h.
Referenced by clang::clangd::DelegatingCDB::getProjectInfo().
|
inlinevirtual |
Get the modules in the closest project to File
.
Reimplemented in clang::clangd::DelegatingCDB, and clang::clangd::DirectoryBasedGlobalCompilationDatabase.
Definition at line 51 of file GlobalCompilationDatabase.h.
Referenced by clang::clangd::DelegatingCDB::getProjectModules().
|
inline |
The callback is notified when files may have new compile commands.
The argument is a list of full file paths.
Definition at line 67 of file GlobalCompilationDatabase.h.
References clang::clangd::Event< T >::observe(), and OnCommandChanged.
|
mutableprotected |
Definition at line 72 of file GlobalCompilationDatabase.h.
Referenced by clang::clangd::DelegatingCDB::DelegatingCDB(), clang::clangd::OverlayCDB::setCompileCommand(), and watch().