diff options
Diffstat (limited to 'include/clang/Lex/ModuleLoader.h')
-rw-r--r-- | include/clang/Lex/ModuleLoader.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/clang/Lex/ModuleLoader.h b/include/clang/Lex/ModuleLoader.h index 70770d17e9ff..ee0638b57f87 100644 --- a/include/clang/Lex/ModuleLoader.h +++ b/include/clang/Lex/ModuleLoader.h @@ -109,6 +109,16 @@ public: Module::NameVisibilityKind Visibility, bool IsInclusionDirective) = 0; + /// Attempt to load the given module from the specified source buffer. Does + /// not make any submodule visible; for that, use loadModule or + /// makeModuleVisible. + /// + /// \param Loc The location at which the module was loaded. + /// \param ModuleName The name of the module to build. + /// \param Source The source of the module: a (preprocessed) module map. + virtual void loadModuleFromSource(SourceLocation Loc, StringRef ModuleName, + StringRef Source) = 0; + /// \brief Make the given module visible. virtual void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, @@ -136,6 +146,30 @@ public: bool HadFatalFailure; }; + +/// A module loader that doesn't know how to load modules. +class TrivialModuleLoader : public ModuleLoader { +public: + ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective) override { + return ModuleLoadResult(); + } + + void loadModuleFromSource(SourceLocation ImportLoc, StringRef ModuleName, + StringRef Source) override {} + + void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, + SourceLocation ImportLoc) override {} + + GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override { + return nullptr; + } + bool lookupMissingImports(StringRef Name, + SourceLocation TriggerLoc) override { + return 0; + } +}; } |