clang 10.0.0git

Public Member Functions | Public Attributes | List of all members
clang::ModuleLoader Class Referenceabstract

Abstract interface for a module loader. More...

`#include "clang/Lex/ModuleLoader.h"`

Inheritance diagram for clang::ModuleLoader:
[legend]
Collaboration diagram for clang::ModuleLoader:
[legend]

## Public Member Functions
| ModuleLoader (bool BuildingModule=false)
virtual | ~ModuleLoader ()
bool | buildingModule () const
| Returns true if this instance is building a module. More...
void | setBuildingModule (bool BuildingModuleFlag)
| Flag indicating whether this instance is building a module. More...
virtual ModuleLoadResult | loadModule (SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective)=0
| Attempt to load the given module. More...
virtual void | createModuleFromSource (SourceLocation Loc, StringRef ModuleName, StringRef Source)=0
| Attempt to create the given module from the specified source buffer. More...
virtual void | makeModuleVisible (Module *Mod, Module::NameVisibilityKind Visibility, SourceLocation ImportLoc)=0
| Make the given module visible. More...
virtual GlobalModuleIndex * | loadGlobalModuleIndex (SourceLocation TriggerLoc)=0
| Load, create, or return global module. More...
virtual bool | lookupMissingImports (StringRef Name, SourceLocation TriggerLoc)=0
| Check global module index for missing imports. More...

## Public Attributes
bool | HadFatalFailure = false

## Detailed 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.

Definition at line 80 of file ModuleLoader.h.

## Constructor & Destructor Documentation

## ◆ ModuleLoader()

clang::ModuleLoader::ModuleLoader | ( | bool | BuildingModule = `false` | ) |
| inline explicit

Definition at line 85 of file ModuleLoader.h.

## ◆ ~ModuleLoader()

ModuleLoader::~ModuleLoader | ( |  | ) |
| virtual default

Referenced by clang::Preprocessor::HandleComment().

## Member Function Documentation

## ◆ buildingModule()

bool clang::ModuleLoader::buildingModule | ( |  | ) | const
| inline

Returns true if this instance is building a module.

Definition at line 91 of file ModuleLoader.h.

Referenced by clang::CompilerInstance::loadGlobalModuleIndex().

## ◆ createModuleFromSource()

virtual void clang::ModuleLoader::createModuleFromSource | ( | SourceLocation | Loc,
|  | StringRef | ModuleName,
|  | StringRef | Source
| ) |  |
| pure virtual

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.

Parameters

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

Implemented in clang::CompilerInstance, and clang::TrivialModuleLoader.

## ◆ loadGlobalModuleIndex()

virtual GlobalModuleIndex* clang::ModuleLoader::loadGlobalModuleIndex | ( | SourceLocation | TriggerLoc | ) |
| pure virtual

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.

Parameters

  TriggerLoc | The location for what triggered the load.

Returns
  Returns null if load failed.

Implemented in clang::CompilerInstance, and clang::TrivialModuleLoader.

## ◆ loadModule()

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

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.

Parameters

  ImportLoc | The location of the 'import' keyword.
  Path | The identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector".
  Visibility | The visibility provided for the names in the loaded module.
  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.

Implemented in clang::CompilerInstance, and clang::TrivialModuleLoader.

Referenced by clang::Preprocessor::LexAfterModuleImport(), and clang::Preprocessor::LexOnOffSwitch().

## ◆ lookupMissingImports()

virtual bool clang::ModuleLoader::lookupMissingImports | ( | StringRef | Name,
|  | SourceLocation | TriggerLoc
| ) |  |
| pure virtual

Check global module index for missing imports.

Parameters

  Name | The symbol name to look for.
  TriggerLoc | The location for what triggered the load.

Returns
  Returns true if any modules with that symbol found.

Implemented in clang::CompilerInstance, and clang::TrivialModuleLoader.

## ◆ makeModuleVisible()

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

Make the given module visible.

Implemented in clang::CompilerInstance, and clang::TrivialModuleLoader.

## ◆ setBuildingModule()

void clang::ModuleLoader::setBuildingModule | ( | bool | BuildingModuleFlag | ) |
| inline

Flag indicating whether this instance is building a module.

Definition at line 96 of file ModuleLoader.h.

## Member Data Documentation

## ◆ HadFatalFailure

bool clang::ModuleLoader::HadFatalFailure = false

Definition at line 160 of file ModuleLoader.h.

Referenced by clang::Preprocessor::hadModuleLoaderFatalFailure(), clang::PCHGenerator::HandleTranslationUnit(), and selectModuleSource().

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

- include/clang/Lex/ModuleLoader.h
- lib/Lex/Preprocessor.cpp