clang-tools  14.0.0git
Public Member Functions | Public Attributes | List of all members
clang::clangd::MockCompilationDatabase Class Reference

#include <TestFS.h>

Inheritance diagram for clang::clangd::MockCompilationDatabase:
Inheritance graph
[legend]
Collaboration diagram for clang::clangd::MockCompilationDatabase:
Collaboration graph
[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< ProjectInfogetProjectInfo (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...
 
virtual bool blockUntilIdle (Deadline D) const
 If the CDB does any asynchronous work, wait for it to complete. 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 55 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
overridevirtual

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, and FileName.

◆ getProjectInfo()

llvm::Optional< ProjectInfo > clang::clangd::MockCompilationDatabase::getProjectInfo ( PathRef  File) const
overridevirtual

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 70 of file TestFS.h.

Referenced by getCompileCommand().


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