class Module

Declaration

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

Description

Describes a module or submodule.

Declared at: clang/include/clang/Basic/Module.h:96

Member Variables

public std::string Name
The name of this module.
public clang::SourceLocation DefinitionLoc
The location of the module definition.
public clang::Module::ModuleKind Kind = ModuleMapModule
The kind of this module.
public clang::Module* Parent
The parent of this module. This will be NULL for the top-level module.
public const clang::DirectoryEntry* Directory = nullptr
The build directory of this module. This is the directory in which the module is notionally built, and relative to which its headers are found.
public std::string PresumedModuleMapFile
The presumed file name for the module map defining this module. Only non-empty when building from preprocessed source.
public llvm::PointerUnion<const FileEntry*, const DirectoryEntry*> Umbrella
The umbrella header or directory.
public clang::ASTFileSignature Signature
The module signature.
public std::string UmbrellaAsWritten
The name of the umbrella entry, as written in the module map.
public std::string UmbrellaRelativeToRootModuleDirectory
public std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed, for use in "private" modules.
private std::vector<Module*> SubModules
The submodules of this module, indexed by name.
private llvm::StringMap<unsigned int> SubModuleIndex
A mapping from the submodule name to the index into the\c SubModules vector at which that submodule resides.
private Optional<clang::FileEntryRef> ASTFile
The AST file if this is a top-level module which has a corresponding serialized AST file, or null otherwise.
private llvm::SmallSetVector<const FileEntry*, 2> TopHeaders
The top-level headers associated with this module.
private std::vector<std::string> TopHeaderNames
top-level header filenames that aren't resolved to FileEntries yet.
private llvm::DenseSet<const Module*> VisibleModulesCache
Cache of modules visible to lookup in this module.
private unsigned int VisibilityID
The ID used when referencing this module within a VisibleModuleSet.
public SmallVector<clang::Module::Header, 2>[5] Headers
The headers that are part of this module.
public SmallVector< clang::Module::UnresolvedHeaderDirective, 1> UnresolvedHeaders
Headers that are mentioned in the module map file but that we have not yet attempted to resolve to a file on the file system.
public SmallVector< clang::Module::UnresolvedHeaderDirective, 1> MissingHeaders
Headers that are mentioned in the module map file but could not be found on the file system.
public SmallVector<clang::Module::Requirement, 2> Requirements
If any of these requirements are not available, the \c IsAvailable bit will be false to indicate that this (sub)module is not available.
public clang::Module* ShadowingModule = nullptr
A module with the same name that shadows this module.
public unsigned int IsUnimportable
Whether this module has declared itself unimportable, either because it's missing a requirement from \p Requirements or because it's been shadowed by another module.
public unsigned int HasIncompatibleModuleFile
Whether we tried and failed to load a module file for this module.
public unsigned int IsAvailable
If the module is missing headers or does not meet all requirements then this bit will be 0.
public unsigned int IsFromModuleFile
Whether this module was loaded from a module file.
public unsigned int IsFramework
Whether this is a framework module.
public unsigned int IsExplicit
Whether this is an explicit submodule.
public unsigned int IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers).
public unsigned int IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"' block, and allows the module to be imported within such a block).
public unsigned int IsInferred
Whether this is an inferred submodule (module * { ... }).
public unsigned int InferSubmodules
Submodules can only be inferred for modules with an umbrella header.
public unsigned int InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
public unsigned int InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e.g., the equivalent of "export *").
public unsigned int ConfigMacrosExhaustive
When the set of configuration macros is exhaustive, meaning that no identifier not in this list should affect how the module is built.
public unsigned int NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules.
public unsigned int ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map.
public clang::Module::NameVisibilityKind NameVisibility
The visibility of names within this particular module.
public clang::SourceLocation InferredSubmoduleLoc
The location of the inferred submodule.
public llvm::SmallSetVector<Module*, 2> Imports
The set of modules imported by this module, and on which this module depends.
public SmallVector<clang::Module::ExportDecl, 2> Exports
The set of export declarations.
public SmallVector<clang::Module::UnresolvedExportDecl, 2> UnresolvedExports
The set of export declarations that have yet to be resolved.
public SmallVector<clang::Module*, 2> DirectUses
The directly used modules.
public SmallVector<clang::ModuleId, 2> UnresolvedDirectUses
The set of use declarations that have yet to be resolved.
public llvm::SmallSetVector<const Module*, 2> UndeclaredUses
When \c NoUndeclaredIncludes is true, the set of modules this module tried to import but didn't because they are not direct uses.
public llvm::SmallVector<LinkLibrary, 2> LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used.
public bool UseExportAsModuleLinkName = false
Autolinking uses the framework name for linking purposes when this is false and the export_as name otherwise.
public std::vector<std::string> ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is built.
public std::vector<UnresolvedConflict> UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
public std::vector<Conflict> Conflicts
The list of conflicts.
public static const int NumHeaderKinds = HK_Excluded + 1

Method Overview

Methods

Module(llvm::StringRef Name,
       clang::SourceLocation DefinitionLoc,
       clang::Module* Parent,
       bool IsFramework,
       bool IsExplicit,
       unsigned int VisibilityID)

Description

Construct a new module or submodule.

Declared at: clang/include/clang/Basic/Module.h:440

Parameters

llvm::StringRef Name
clang::SourceLocation DefinitionLoc
clang::Module* Parent
bool IsFramework
bool IsExplicit
unsigned int VisibilityID

void addRequirement(
    llvm::StringRef Feature,
    bool RequiredState,
    const clang::LangOptions& LangOpts,
    const clang::TargetInfo& Target)

Description

Add the given feature requirement to the list of features required by this module.

Declared at: clang/include/clang/Basic/Module.h:660

Parameters

llvm::StringRef Feature
The feature that is required by this module (and its submodules).
bool RequiredState
The required state of this feature: \c true if it must be present, \c false if it must be absent.
const clang::LangOptions& LangOpts
The set of language options that will be used to evaluate the availability of this feature.
const clang::TargetInfo& Target
The target options that will be used to evaluate the availability of this feature.

void addTopHeader(const clang::FileEntry* File)

Description

Add a top-level header associated with this module.

Declared at: clang/include/clang/Basic/Module.h:632

Parameters

const clang::FileEntry* File

void addTopHeaderFilename(
    llvm::StringRef Filename)

Description

Add a top-level header filename associated with this module.

Declared at: clang/include/clang/Basic/Module.h:635

Parameters

llvm::StringRef Filename

void buildVisibleModulesCache() const

Declared at: clang/include/clang/Basic/Module.h:731

bool directlyUses(const clang::Module* Requested)

Description

Determine whether this module has declared its intention to directly use another module.

Declared at: clang/include/clang/Basic/Module.h:644

Parameters

const clang::Module* Requested

void dump() const

Description

Dump the contents of this module to the given output stream.

Declared at: clang/include/clang/Basic/Module.h:728

clang::Module* findOrInferSubmodule(
    llvm::StringRef Name)

Declared at: clang/include/clang/Basic/Module.h:671

Parameters

llvm::StringRef Name

clang::Module* findSubmodule(
    llvm::StringRef Name) const

Description

Find the submodule with the given name.

Declared at: clang/include/clang/Basic/Module.h:670

Parameters

llvm::StringRef Name

Returns

The submodule if found, or NULL otherwise.

bool fullModuleNameIs(
    ArrayRef<llvm::StringRef> nameParts) const

Description

Whether the full name of this module is equal to joining\p nameParts with "."s. This is more efficient than getFullModuleName().

Declared at: clang/include/clang/Basic/Module.h:582

Parameters

ArrayRef<llvm::StringRef> nameParts

clang::OptionalFileEntryRefDegradesToFileEntryPtr
getASTFile() const

Description

The serialized AST file for this module, if one was created.

Declared at: clang/include/clang/Basic/Module.h:601

void getExportedModules(
    SmallVectorImpl<clang::Module*>& Exported)
    const

Description

Appends this module's list of exported modules to \p Exported. This provides a subset of immediately imported modules (the ones that are directly exported), not the complete set of exported modules.

Declared at: clang/include/clang/Basic/Module.h:718

Parameters

SmallVectorImpl<clang::Module*>& Exported

std::string getFullModuleName(
    bool AllowStringLiterals = false) const

Description

Retrieve the full name of this module, including the path from its top-level module.

Declared at: clang/include/clang/Basic/Module.h:576

Parameters

bool AllowStringLiterals = false
If \c true, components that might not be lexically valid as identifiers will be emitted as string literals.

clang::Module* getGlobalModuleFragment()

Description

Get the Global Module Fragment (sub-module) for this module, it there is one.

Declared at: clang/include/clang/Basic/Module.h:677

Returns

The GMF sub-module if found, or NULL otherwise.

static llvm::StringRef getModuleInputBufferName()

Declared at: clang/include/clang/Basic/Module.h:720

llvm::StringRef getPrimaryModuleInterfaceName()
    const

Description

Get the primary module interface name from a partition.

Declared at: clang/include/clang/Basic/Module.h:551

clang::Module* getPrivateModuleFragment()

Description

Get the Private Module Fragment (sub-module) for this module, it there is one.

Declared at: clang/include/clang/Basic/Module.h:683

Returns

The PMF sub-module if found, or NULL otherwise.

ArrayRef<const clang::FileEntry*> getTopHeaders(
    clang::FileManager& FileMgr)

Description

The top-level headers associated with this module.

Declared at: clang/include/clang/Basic/Module.h:640

Parameters

clang::FileManager& FileMgr

clang::Module* getTopLevelModule()

Description

Retrieve the top-level module for this (sub)module, which may be this module.

Declared at: clang/include/clang/Basic/Module.h:586

const clang::Module* getTopLevelModule() const

Description

Retrieve the top-level module for this (sub)module, which may be this module.

Declared at: clang/include/clang/Basic/Module.h:593

llvm::StringRef getTopLevelModuleName() const

Description

Retrieve the name of the top-level module.

Declared at: clang/include/clang/Basic/Module.h:596

clang::Module::DirectoryName getUmbrellaDir()
    const

Description

Retrieve the directory for which this module serves as the umbrella.

Declared at: clang/include/clang/Basic/Module.h:614

clang::Module::Header getUmbrellaHeader() const

Description

Retrieve the header that serves as the umbrella header for this module.

Declared at: clang/include/clang/Basic/Module.h:618

unsigned int getVisibilityID() const

Declared at: clang/include/clang/Basic/Module.h:697

bool hasUmbrellaDir() const

Description

Determine whether this module has an umbrella directory that is not based on an umbrella header.

Declared at: clang/include/clang/Basic/Module.h:627

bool isAvailable(
    const clang::LangOptions& LangOpts,
    const clang::TargetInfo& Target,
    clang::Module::Requirement& Req,
    clang::Module::UnresolvedHeaderDirective&
        MissingHeader,
    clang::Module*& ShadowingModule) const

Description

Determine whether this module is available for use within the current translation unit.

Declared at: clang/include/clang/Basic/Module.h:485

Parameters

const clang::LangOptions& LangOpts
The language options used for the current translation unit.
const clang::TargetInfo& Target
The target options used for the current translation unit.
clang::Module::Requirement& Req
If this module is unavailable because of a missing requirement, this parameter will be set to one of the requirements that is not met for use of this module.
clang::Module::UnresolvedHeaderDirective& MissingHeader
If this module is unavailable because of a missing header, this parameter will be set to one of the missing headers.
clang::Module*& ShadowingModule
If this module is unavailable because it is shadowed, this parameter will be set to the shadowing module.

bool isAvailable() const

Description

Determine whether this module is available for use within the current translation unit.

Declared at: clang/include/clang/Basic/Module.h:466

bool isGlobalModule() const

Description

Does this Module scope describe a fragment of the global module within some C++ module.

Declared at: clang/include/clang/Basic/Module.h:169

bool isHeaderLikeModule() const

Description

Is this module have similar semantics as headers.

Declared at: clang/include/clang/Basic/Module.h:529

bool isHeaderUnit() const

Description

Is this module a header unit.

Declared at: clang/include/clang/Basic/Module.h:540

bool isInterfaceOrPartition() const

Declared at: clang/include/clang/Basic/Module.h:542

bool isModuleInterfaceUnit() const

Declared at: clang/include/clang/Basic/Module.h:546

bool isModuleMapModule() const

Declared at: clang/include/clang/Basic/Module.h:173

bool isModulePartition() const

Description

Is this a module partition.

Declared at: clang/include/clang/Basic/Module.h:534

bool isModulePurview() const

Description

Does this Module scope describe part of the purview of a named C++ module?

Declared at: clang/include/clang/Basic/Module.h:161

bool isModuleVisible(const clang::Module* M) const

Description

Determine whether the specified module would be visible to a lookup at the end of this module. FIXME: This may return incorrect results for (submodules of) the module currently being built, if it's queried before we see all of its imports.

Declared at: clang/include/clang/Basic/Module.h:691

Parameters

const clang::Module* M

bool isPartOfFramework() const

Description

Determine whether this module is a part of a framework, either because it is a framework module or because it is a submodule of a framework module.

Declared at: clang/include/clang/Basic/Module.h:505

bool isPrivateModule() const

Declared at: clang/include/clang/Basic/Module.h:171

bool isSubFramework() const

Description

Determine whether this module is a subframework of another framework.

Declared at: clang/include/clang/Basic/Module.h:515

bool isSubModule() const

Description

Determine whether this module is a submodule.

Declared at: clang/include/clang/Basic/Module.h:492

bool isSubModuleOf(
    const clang::Module* Other) const

Description

Check if this module is a (possibly transitive) submodule of \p Other. The 'A is a submodule of B' relation is a partial order based on the the parent-child relationship between individual modules. Returns \c false if \p Other is \c nullptr.

Declared at: clang/include/clang/Basic/Module.h:500

Parameters

const clang::Module* Other

bool isUnimportable(
    const clang::LangOptions& LangOpts,
    const clang::TargetInfo& Target,
    clang::Module::Requirement& Req,
    clang::Module*& ShadowingModule) const

Description

Determine whether this module has been declared unimportable.

Declared at: clang/include/clang/Basic/Module.h:461

Parameters

const clang::LangOptions& LangOpts
The language options used for the current translation unit.
const clang::TargetInfo& Target
The target options used for the current translation unit.
clang::Module::Requirement& Req
If this module is unimportable because of a missing requirement, this parameter will be set to one of the requirements that is not met for use of this module.
clang::Module*& ShadowingModule
If this module is unimportable because it is shadowed, this parameter will be set to the shadowing module.

bool isUnimportable() const

Description

Determine whether this module has been declared unimportable.

Declared at: clang/include/clang/Basic/Module.h:446

void markUnavailable(bool Unimportable)

Description

Mark this module and all of its submodules as unavailable.

Declared at: clang/include/clang/Basic/Module.h:665

Parameters

bool Unimportable

void print(llvm::raw_ostream& OS,
           unsigned int Indent = 0,
           bool Dump = false) const

Description

Print the module map for this module to the given stream.

Declared at: clang/include/clang/Basic/Module.h:725

Parameters

llvm::raw_ostream& OS
unsigned int Indent = 0
bool Dump = false

void setASTFile(
    Optional<clang::FileEntryRef> File)

Description

Set the serialized AST file for the top-level module of this module.

Declared at: clang/include/clang/Basic/Module.h:606

Parameters

Optional<clang::FileEntryRef> File

void setParent(clang::Module* M)

Description

Set the parent of this module. This should only be used if the parent could not be set during module creation.

Declared at: clang/include/clang/Basic/Module.h:521

Parameters

clang::Module* M

clang::Module::submodule_const_iterator
submodule_begin() const

Declared at: clang/include/clang/Basic/Module.h:703

clang::Module::submodule_iterator
submodule_begin()

Declared at: clang/include/clang/Basic/Module.h:702

clang::Module::submodule_const_iterator
submodule_end() const

Declared at: clang/include/clang/Basic/Module.h:705

clang::Module::submodule_iterator submodule_end()

Declared at: clang/include/clang/Basic/Module.h:704

llvm::iterator_range<submodule_iterator>
submodules()

Declared at: clang/include/clang/Basic/Module.h:707

llvm::iterator_range<submodule_const_iterator>
submodules() const

Declared at: clang/include/clang/Basic/Module.h:710

~Module()

Declared at: clang/include/clang/Basic/Module.h:443