clang-tools  7.0.0
Public Member Functions | List of all members
clang::clangd::CachingCompilationDb Class Reference

A wrapper around GlobalCompilationDatabase that caches the compile commands. More...

#include <GlobalCompilationDatabase.h>

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

Public Member Functions

 CachingCompilationDb (const GlobalCompilationDatabase &InnerCDB)
 
llvm::Optional< tooling::CompileCommand > getCompileCommand (PathRef File) const override
 Gets compile command for File from cache or CDB if it's not in the cache. More...
 
tooling::CompileCommand getFallbackCommand (PathRef File) const override
 Forwards to the inner CDB. Results of this function are not cached. More...
 
void invalidate (PathRef File)
 Removes an entry for File if it's present in the cache. More...
 
void clear ()
 Removes all cached compile commands. More...
 
- Public Member Functions inherited from clang::clangd::GlobalCompilationDatabase
virtual ~GlobalCompilationDatabase ()=default
 

Detailed Description

A wrapper around GlobalCompilationDatabase that caches the compile commands.

Note that only results of getCompileCommand are cached.

Definition at line 91 of file GlobalCompilationDatabase.h.

Constructor & Destructor Documentation

◆ CachingCompilationDb()

clang::clangd::CachingCompilationDb::CachingCompilationDb ( const GlobalCompilationDatabase InnerCDB)
explicit

Definition at line 122 of file GlobalCompilationDatabase.cpp.

Member Function Documentation

◆ clear()

void clang::clangd::CachingCompilationDb::clear ( )

Removes all cached compile commands.

Definition at line 150 of file GlobalCompilationDatabase.cpp.

◆ getCompileCommand()

llvm::Optional< tooling::CompileCommand > clang::clangd::CachingCompilationDb::getCompileCommand ( PathRef  File) const
overridevirtual

Gets compile command for File from cache or CDB if it's not in the cache.

Implements clang::clangd::GlobalCompilationDatabase.

Definition at line 127 of file GlobalCompilationDatabase.cpp.

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

◆ getFallbackCommand()

tooling::CompileCommand clang::clangd::CachingCompilationDb::getFallbackCommand ( PathRef  File) const
overridevirtual

Forwards to the inner CDB. Results of this function are not cached.

Reimplemented from clang::clangd::GlobalCompilationDatabase.

Definition at line 141 of file GlobalCompilationDatabase.cpp.

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

◆ invalidate()

void clang::clangd::CachingCompilationDb::invalidate ( PathRef  File)

Removes an entry for File if it's present in the cache.

Definition at line 145 of file GlobalCompilationDatabase.cpp.


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