clang-tools 10.0.0

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

`#include <TestFS.h>`

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

## Public Member Functions
| MockCompilationDatabase (StringRef Directory=StringRef(), StringRef RelPathPrefix=StringRef())
| If `Directory` is not empty, use that as the Directory field of the CompileCommand, and as project SourceRoot. More...
llvm::Optional< tooling::CompileCommand > | getCompileCommand (PathRef File) const override
| If there are any known-good commands for building this file, returns one. More...
llvm::Optional< ProjectInfo > | getProjectInfo (PathRef File) const override
| Finds the closest project to `File`. More...
Public Member Functions inherited from clang::clangd::GlobalCompilationDatabase
virtual | ~GlobalCompilationDatabase ()=default
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...

## Public Attributes
std::vector< std::string > | ExtraClangFlags

## 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

Definition at line 42 of file TestFS.h.

## Constructor & Destructor Documentation

## ◆ MockCompilationDatabase()

clang::clangd::MockCompilationDatabase::MockCompilationDatabase | ( | StringRef | Directory = `StringRef()`,
|  | StringRef | RelPathPrefix = `StringRef()`
| ) |  |

If `Directory` is not empty, use that as the Directory field of the CompileCommand, and as project SourceRoot.

If `RelPathPrefix` is not empty, use that as a prefix in front of the source file name, instead of using an absolute path.

Definition at line 36 of file TestFS.cpp.

## Member Function Documentation

## ◆ getCompileCommand()

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

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

Implements clang::clangd::GlobalCompilationDatabase.

Definition at line 49 of file TestFS.cpp.

References CommandLine, ExtraClangFlags, FileName, and clang::clangd::None.

## ◆ getProjectInfo()

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

Finds the closest project to `File`.

Reimplemented from clang::clangd::GlobalCompilationDatabase.

Definition at line 44 of file TestFS.cpp.

## Member Data Documentation

## ◆ ExtraClangFlags

std::vector<std::string> clang::clangd::MockCompilationDatabase::ExtraClangFlags

Definition at line 57 of file TestFS.h.

Referenced by getCompileCommand().

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

- TestFS.h
- TestFS.cpp