clang-tools 19.0.0git
Classes | Public Member Functions | Friends | List of all members
clang::clangd::DirectoryBasedGlobalCompilationDatabase Class Reference

Gets compile args from tooling::CompilationDatabases built for parent directories. More...

#include <GlobalCompilationDatabase.h>

Inheritance diagram for clang::clangd::DirectoryBasedGlobalCompilationDatabase:
Inheritance graph
[legend]

Classes

class  BroadcastThread
 
class  DirectoryCache
 
struct  Options
 

Public Member Functions

 DirectoryBasedGlobalCompilationDatabase (const Options &Opts)
 
 ~DirectoryBasedGlobalCompilationDatabase () override
 
std::optional< tooling::CompileCommand > getCompileCommand (PathRef File) const override
 Scans File's parents looking for compilation databases.
 
std::optional< ProjectInfogetProjectInfo (PathRef File) const override
 Returns the path to first directory containing a compilation database in File's parents.
 
bool blockUntilIdle (Deadline Timeout) const override
 If the CDB does any asynchronous work, wait for it to complete.
 
- Public Member Functions inherited from clang::clangd::GlobalCompilationDatabase
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< ProjectInfogetProjectInfo (PathRef File) const
 Finds 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.
 

Friends

class DirectoryBasedGlobalCompilationDatabaseCacheTest
 

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

Gets compile args from tooling::CompilationDatabases built for parent directories.

Definition at line 91 of file GlobalCompilationDatabase.h.

Constructor & Destructor Documentation

◆ DirectoryBasedGlobalCompilationDatabase()

clang::clangd::DirectoryBasedGlobalCompilationDatabase::DirectoryBasedGlobalCompilationDatabase ( const Options Opts)

◆ ~DirectoryBasedGlobalCompilationDatabase()

clang::clangd::DirectoryBasedGlobalCompilationDatabase::~DirectoryBasedGlobalCompilationDatabase ( )
overridedefault

References FileName.

Member Function Documentation

◆ blockUntilIdle()

bool clang::clangd::DirectoryBasedGlobalCompilationDatabase::blockUntilIdle ( Deadline  D) const
overridevirtual

If the CDB does any asynchronous work, wait for it to complete.

For use in tests.

Reimplemented from clang::clangd::GlobalCompilationDatabase.

Definition at line 725 of file GlobalCompilationDatabase.cpp.

◆ getCompileCommand()

std::optional< tooling::CompileCommand > clang::clangd::DirectoryBasedGlobalCompilationDatabase::getCompileCommand ( PathRef  File) const
overridevirtual

Scans File's parents looking for compilation databases.

Any extra flags will be added. Might trigger OnCommandChanged, if CDB wasn't broadcasted yet.

Implements clang::clangd::GlobalCompilationDatabase.

Definition at line 360 of file GlobalCompilationDatabase.cpp.

References clang::clangd::File, clang::clangd::log(), clang::clangd::DirectoryBasedGlobalCompilationDatabase::Options::RevalidateAfter, and clang::clangd::DirectoryBasedGlobalCompilationDatabase::Options::RevalidateMissingAfter.

◆ getProjectInfo()

std::optional< ProjectInfo > clang::clangd::DirectoryBasedGlobalCompilationDatabase::getProjectInfo ( PathRef  File) const
overridevirtual

Returns the path to first directory containing a compilation database in File's parents.

Reimplemented from clang::clangd::GlobalCompilationDatabase.

Definition at line 731 of file GlobalCompilationDatabase.cpp.

References clang::clangd::File.

Friends And Related Function Documentation

◆ DirectoryBasedGlobalCompilationDatabaseCacheTest

Definition at line 161 of file GlobalCompilationDatabase.h.


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