clang-tools 10.0.0

Public Types | Public Member Functions | Protected Attributes | List of all members
clang::clangd::GlobalCompilationDatabase Class Referenceabstract

Provides compilation arguments used for parsing C and C++ files. More...

`#include <GlobalCompilationDatabase.h>`

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

## Public Types
using | CommandChanged = Event< std::vector< std::string > >

## Public Member Functions
virtual | ~GlobalCompilationDatabase ()=default
virtual llvm::Optional< tooling::CompileCommand > | getCompileCommand (PathRef File) const =0
| If there are any known-good commands for building this file, returns one. More...
virtual llvm::Optional< ProjectInfo > | getProjectInfo (PathRef File) const
| Finds the closest project to `File`. More...
virtual tooling::CompileCommand | getFallbackCommand (PathRef File) const
| Makes a guess at how to build a file. More...
CommandChanged::Subscription | watch (CommandChanged::Listener L) const
| The callback is notified when files may have new compile commands. More...

## Protected Attributes
CommandChanged | OnCommandChanged

## Detailed Description

Provides compilation arguments used for parsing C and C++ files.

Definition at line 35 of file GlobalCompilationDatabase.h.

## Member Typedef Documentation

## ◆ CommandChanged

using clang::clangd::GlobalCompilationDatabase::CommandChanged = Event<std::vector<std::string> >

Definition at line 53 of file GlobalCompilationDatabase.h.

## Constructor & Destructor Documentation

## ◆ ~GlobalCompilationDatabase()

virtual clang::clangd::GlobalCompilationDatabase::~GlobalCompilationDatabase | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ getCompileCommand()

virtual llvm::Optional<tooling::CompileCommand> clang::clangd::GlobalCompilationDatabase::getCompileCommand | ( | PathRef | File | ) | const
| pure virtual

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

Implemented in clang::clangd::OverlayCDB, clang::clangd::DirectoryBasedGlobalCompilationDatabase, and clang::clangd::MockCompilationDatabase.

Referenced by clang::clangd::OverlayCDB::getCompileCommand().

## ◆ getFallbackCommand()

tooling::CompileCommand clang::clangd::GlobalCompilationDatabase::getFallbackCommand | ( | PathRef | File | ) | const
| 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::OverlayCDB.

Definition at line 45 of file GlobalCompilationDatabase.cpp.

References clang::clangd::DirectoryBasedGlobalCompilationDatabase::DirectoryBasedGlobalCompilationDatabase().

Referenced by clang::clangd::OverlayCDB::getFallbackCommand().

## ◆ getProjectInfo()

virtual llvm::Optional<ProjectInfo> clang::clangd::GlobalCompilationDatabase::getProjectInfo | ( | PathRef | File | ) | const
| inline virtual

Finds the closest project to `File`.

Reimplemented in clang::clangd::OverlayCDB, clang::clangd::DirectoryBasedGlobalCompilationDatabase, and clang::clangd::MockCompilationDatabase.

Definition at line 44 of file GlobalCompilationDatabase.h.

References clang::clangd::None.

Referenced by clang::clangd::OverlayCDB::getProjectInfo().

## ◆ watch()

CommandChanged::Subscription clang::clangd::GlobalCompilationDatabase::watch | ( | CommandChanged::Listener | L | ) | const
| inline

The callback is notified when files may have new compile commands.

The argument is a list of full file paths.

Definition at line 56 of file GlobalCompilationDatabase.h.

Referenced by clang::clangd::OverlayCDB::OverlayCDB().

## Member Data Documentation

## ◆ OnCommandChanged

CommandChanged clang::clangd::GlobalCompilationDatabase::OnCommandChanged
| mutable protected

Definition at line 61 of file GlobalCompilationDatabase.h.

Referenced by clang::clangd::OverlayCDB::OverlayCDB(), and clang::clangd::OverlayCDB::setCompileCommand().

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

- GlobalCompilationDatabase.h
- GlobalCompilationDatabase.cpp