class ModuleLoader

Declaration

class ModuleLoader { /* full declaration omitted */ };

Description

Abstract interface for a module loader. This abstract interface describes a module loader, which is responsible for resolving a module name (e.g., "std") to an actual module file, and then loading that module.

Declared at: clang/include/clang/Lex/ModuleLoader.h:77

Member Variables

private bool BuildingModule
public bool HadFatalFailure = false

Method Overview

  • public ModuleLoader(bool BuildingModule = false)
  • public bool buildingModule() const
  • public virtual void createModuleFromSource(clang::SourceLocation Loc, llvm::StringRef ModuleName, llvm::StringRef Source)
  • public virtual clang::GlobalModuleIndex * loadGlobalModuleIndex(clang::SourceLocation TriggerLoc)
  • public virtual clang::ModuleLoadResult loadModule(clang::SourceLocation ImportLoc, clang::ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective)
  • public virtual bool lookupMissingImports(llvm::StringRef Name, clang::SourceLocation TriggerLoc)
  • public virtual void makeModuleVisible(clang::Module * Mod, Module::NameVisibilityKind Visibility, clang::SourceLocation ImportLoc)
  • public void setBuildingModule(bool BuildingModuleFlag)
  • public virtual ~ModuleLoader()

Methods

ModuleLoader(bool BuildingModule = false)

Declared at: clang/include/clang/Lex/ModuleLoader.h:82

Parameters

bool BuildingModule = false

bool buildingModule() const

Description

Returns true if this instance is building a module.

Declared at: clang/include/clang/Lex/ModuleLoader.h:88

virtual void createModuleFromSource(
    clang::SourceLocation Loc,
    llvm::StringRef ModuleName,
    llvm::StringRef Source)

Description

Attempt to create the given module from the specified source buffer. Does not load the module or make any submodule visible; for that, use loadModule and makeModuleVisible.

Declared at: clang/include/clang/Lex/ModuleLoader.h:129

Parameters

clang::SourceLocation Loc
The location at which to create the module.
llvm::StringRef ModuleName
The name of the module to create.
llvm::StringRef Source
The source of the module: a (preprocessed) module map.

virtual clang::GlobalModuleIndex*
loadGlobalModuleIndex(
    clang::SourceLocation TriggerLoc)

Description

Load, create, or return global module. This function returns an existing global module index, if one had already been loaded or created, or loads one if it exists, or creates one if it doesn't exist. Also, importantly, if the index doesn't cover all the modules in the module map, it will be update to do so here, because of its use in searching for needed module imports and associated fixit messages.

Declared at: clang/include/clang/Lex/ModuleLoader.h:147

Parameters

clang::SourceLocation TriggerLoc
The location for what triggered the load.

Returns

Returns null if load failed.

virtual clang::ModuleLoadResult loadModule(
    clang::SourceLocation ImportLoc,
    clang::ModuleIdPath Path,
    Module::NameVisibilityKind Visibility,
    bool IsInclusionDirective)

Description

Attempt to load the given module. This routine attempts to load the module described by the given parameters. If there is a module cache, this may implicitly compile the module before loading it.

Declared at: clang/include/clang/Lex/ModuleLoader.h:117

Parameters

clang::SourceLocation ImportLoc
The location of the 'import' keyword.
clang::ModuleIdPath Path
The identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector".
Module::NameVisibilityKind Visibility
The visibility provided for the names in the loaded module.
bool IsInclusionDirective
Indicates that this module is being loaded implicitly, due to the presence of an inclusion directive. Otherwise, it is being loaded due to an import declaration.

Returns

If successful, returns the loaded module. Otherwise, returns NULL to indicate that the module could not be loaded.

virtual bool lookupMissingImports(
    llvm::StringRef Name,
    clang::SourceLocation TriggerLoc)

Description

Check global module index for missing imports.

Declared at: clang/include/clang/Lex/ModuleLoader.h:154

Parameters

llvm::StringRef Name
The symbol name to look for.
clang::SourceLocation TriggerLoc
The location for what triggered the load.

Returns

Returns true if any modules with that symbol found.

virtual void makeModuleVisible(
    clang::Module* Mod,
    Module::NameVisibilityKind Visibility,
    clang::SourceLocation ImportLoc)

Description

Make the given module visible.

Declared at: clang/include/clang/Lex/ModuleLoader.h:133

Parameters

clang::Module* Mod
Module::NameVisibilityKind Visibility
clang::SourceLocation ImportLoc

void setBuildingModule(bool BuildingModuleFlag)

Description

Flag indicating whether this instance is building a module.

Declared at: clang/include/clang/Lex/ModuleLoader.h:93

Parameters

bool BuildingModuleFlag

virtual ~ModuleLoader()

Declared at: clang/include/clang/Lex/ModuleLoader.h:85