clang-tools 20.0.0git
Public Member Functions | List of all members
clang::clangd::PrerequisiteModules Class Referenceabstract

Store all the needed module files information to parse a single source file. More...

#include <ModulesBuilder.h>

Public Member Functions

virtual void adjustHeaderSearchOptions (HeaderSearchOptions &Options) const =0
 Change commands to load the module files recorded in this PrerequisiteModules first.
 
virtual bool canReuse (const CompilerInvocation &CI, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >) const =0
 Whether or not the built module files are up to date.
 
virtual ~PrerequisiteModules ()=default
 

Detailed Description

Store all the needed module files information to parse a single source file.

e.g.,

// a.cppm
export module a;
// b.cppm
export module b;
import a;
// c.cppm
export module c;
import b;

For the source file c.cppm, an instance of the class will store the module files for a.cppm and b.cppm. But the module file for c.cppm won't be stored. Since it is not needed to parse c.cppm.

Users should only get PrerequisiteModules from ModulesBuilder::buildPrerequisiteModulesFor(...).

Users can detect whether the PrerequisiteModules is still up to date by calling the canReuse() member function.

The users should call adjustHeaderSearchOptions(...) to update the compilation commands to select the built module files first. Before calling adjustHeaderSearchOptions(), users should call canReuse() first to check if all the stored module files are valid. In case they are not valid, users should call ModulesBuilder::buildPrerequisiteModulesFor(...) again to get the new PrerequisiteModules.

Definition at line 66 of file ModulesBuilder.h.

Constructor & Destructor Documentation

◆ ~PrerequisiteModules()

virtual clang::clangd::PrerequisiteModules::~PrerequisiteModules ( )
virtualdefault

Member Function Documentation

◆ adjustHeaderSearchOptions()

virtual void clang::clangd::PrerequisiteModules::adjustHeaderSearchOptions ( HeaderSearchOptions &  Options) const
pure virtual

Change commands to load the module files recorded in this PrerequisiteModules first.

◆ canReuse()

virtual bool clang::clangd::PrerequisiteModules::canReuse ( const CompilerInvocation &  CI,
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >   
) const
pure virtual

Whether or not the built module files are up to date.

Note that this can only be used after building the module files.


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