clang 17.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
clang::Module Class Reference

Describes a module or submodule. More...

#include "clang/Basic/Module.h"

Collaboration diagram for clang::Module:
Collaboration graph
[legend]

Classes

struct  Conflict
 A conflict between two modules. More...
 
struct  DirectoryName
 Information about a directory name as found in the module map file. More...
 
struct  Header
 Information about a header directive as found in the module map file. More...
 
struct  LinkLibrary
 A library or framework to link against when an entity from this module is used. More...
 
struct  UnresolvedConflict
 An unresolved conflict with another module. More...
 
struct  UnresolvedExportDecl
 Describes an exported module that has not yet been resolved (perhaps because the module it refers to has not yet been loaded). More...
 
struct  UnresolvedHeaderDirective
 Stored information about a header directive that was found in the module map file but has not been resolved to a file. More...
 

Public Types

enum  ModuleKind {
  ModuleMapModule , ModuleInterfaceUnit , ModuleHeaderUnit , ModulePartitionInterface ,
  ModulePartitionImplementation , ExplicitGlobalModuleFragment , PrivateModuleFragment , ImplicitGlobalModuleFragment
}
 
enum  HeaderKind {
  HK_Normal , HK_Textual , HK_Private , HK_PrivateTextual ,
  HK_Excluded
}
 
enum  NameVisibilityKind { Hidden , AllVisible }
 Describes the visibility of the various names within a particular module. More...
 
using Requirement = std::pair< std::string, bool >
 An individual requirement: a feature name and a flag indicating the required state of that feature.
 
using ExportDecl = llvm::PointerIntPair< Module *, 1, bool >
 Describes an exported module.
 
using submodule_iterator = std::vector< Module * >::iterator
 
using submodule_const_iterator = std::vector< Module * >::const_iterator
 

Public Member Functions

bool isModulePurview () const
 Does this Module scope describe part of the purview of a standard named C++ module?
 
bool isGlobalModule () const
 Does this Module scope describe a fragment of the global module within some C++ module.
 
bool isExplicitGlobalModule () const
 
bool isImplicitGlobalModule () const
 
bool isPrivateModule () const
 
bool isModuleMapModule () const
 
 Module (StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID)
 Construct a new module or submodule.
 
 ~Module ()
 
bool isUnimportable () const
 Determine whether this module has been declared unimportable.
 
bool isUnimportable (const LangOptions &LangOpts, const TargetInfo &Target, Requirement &Req, Module *&ShadowingModule) const
 Determine whether this module has been declared unimportable.
 
bool isForBuilding (const LangOptions &LangOpts) const
 Determine whether this module can be built in this compilation.
 
bool isAvailable () const
 Determine whether this module is available for use within the current translation unit.
 
bool isAvailable (const LangOptions &LangOpts, const TargetInfo &Target, Requirement &Req, UnresolvedHeaderDirective &MissingHeader, Module *&ShadowingModule) const
 Determine whether this module is available for use within the current translation unit.
 
bool isSubModule () const
 Determine whether this module is a submodule.
 
bool isSubModuleOf (const Module *Other) const
 Check if this module is a (possibly transitive) submodule of Other.
 
bool isPartOfFramework () const
 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.
 
bool isSubFramework () const
 Determine whether this module is a subframework of another framework.
 
void setParent (Module *M)
 Set the parent of this module.
 
bool isHeaderLikeModule () const
 Is this module have similar semantics as headers.
 
bool isModulePartition () const
 Is this a module partition.
 
bool isHeaderUnit () const
 Is this module a header unit.
 
bool isInterfaceOrPartition () const
 
bool isModuleInterfaceUnit () const
 
StringRef getPrimaryModuleInterfaceName () const
 Get the primary module interface name from a partition.
 
std::string getFullModuleName (bool AllowStringLiterals=false) const
 Retrieve the full name of this module, including the path from its top-level module.
 
bool fullModuleNameIs (ArrayRef< StringRef > nameParts) const
 Whether the full name of this module is equal to joining nameParts with "."s.
 
ModulegetTopLevelModule ()
 Retrieve the top-level module for this (sub)module, which may be this module.
 
const ModulegetTopLevelModule () const
 Retrieve the top-level module for this (sub)module, which may be this module.
 
StringRef getTopLevelModuleName () const
 Retrieve the name of the top-level module.
 
OptionalFileEntryRefDegradesToFileEntryPtr getASTFile () const
 The serialized AST file for this module, if one was created.
 
void setASTFile (OptionalFileEntryRef File)
 Set the serialized AST file for the top-level module of this module.
 
DirectoryName getUmbrellaDir () const
 Retrieve the directory for which this module serves as the umbrella.
 
Header getUmbrellaHeader () const
 Retrieve the header that serves as the umbrella header for this module.
 
bool hasUmbrellaDir () const
 Determine whether this module has an umbrella directory that is not based on an umbrella header.
 
void addTopHeader (const FileEntry *File)
 Add a top-level header associated with this module.
 
void addTopHeaderFilename (StringRef Filename)
 Add a top-level header filename associated with this module.
 
ArrayRef< const FileEntry * > getTopHeaders (FileManager &FileMgr)
 The top-level headers associated with this module.
 
bool directlyUses (const Module *Requested)
 Determine whether this module has declared its intention to directly use another module.
 
void addRequirement (StringRef Feature, bool RequiredState, const LangOptions &LangOpts, const TargetInfo &Target)
 Add the given feature requirement to the list of features required by this module.
 
void markUnavailable (bool Unimportable)
 Mark this module and all of its submodules as unavailable.
 
ModulefindSubmodule (StringRef Name) const
 Find the submodule with the given name.
 
ModulefindOrInferSubmodule (StringRef Name)
 
ModulegetGlobalModuleFragment ()
 Get the Global Module Fragment (sub-module) for this module, it there is one.
 
ModulegetPrivateModuleFragment ()
 Get the Private Module Fragment (sub-module) for this module, it there is one.
 
bool isModuleVisible (const Module *M) const
 Determine whether the specified module would be visible to a lookup at the end of this module.
 
unsigned getVisibilityID () const
 
submodule_iterator submodule_begin ()
 
submodule_const_iterator submodule_begin () const
 
submodule_iterator submodule_end ()
 
submodule_const_iterator submodule_end () const
 
llvm::iterator_range< submodule_iteratorsubmodules ()
 
llvm::iterator_range< submodule_const_iteratorsubmodules () const
 
void getExportedModules (SmallVectorImpl< Module * > &Exported) const
 Appends this module's list of exported modules to Exported.
 
void print (raw_ostream &OS, unsigned Indent=0, bool Dump=false) const
 Print the module map for this module to the given stream.
 
void dump () const
 Dump the contents of this module to the given output stream.
 

Static Public Member Functions

static StringRef getModuleInputBufferName ()
 

Public Attributes

std::string Name
 The name of this module.
 
SourceLocation DefinitionLoc
 The location of the module definition.
 
ModuleKind Kind = ModuleMapModule
 The kind of this module.
 
ModuleParent
 The parent of this module.
 
const DirectoryEntryDirectory = nullptr
 The build directory of this module.
 
std::string PresumedModuleMapFile
 The presumed file name for the module map defining this module.
 
llvm::PointerUnion< const FileEntryRef::MapEntry *, const DirectoryEntry * > Umbrella
 The umbrella header or directory.
 
ASTFileSignature Signature
 The module signature.
 
std::string UmbrellaAsWritten
 The name of the umbrella entry, as written in the module map.
 
std::string UmbrellaRelativeToRootModuleDirectory
 
std::string ExportAsModule
 The module through which entities defined in this module will eventually be exposed, for use in "private" modules.
 
SmallVector< Header, 2 > Headers [5]
 The headers that are part of this module.
 
SmallVector< 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.
 
SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders
 Headers that are mentioned in the module map file but could not be found on the file system.
 
SmallVector< Requirement, 2 > Requirements
 The set of language features required to use this module.
 
ModuleShadowingModule = nullptr
 A module with the same name that shadows this module.
 
unsigned IsUnimportable: 1
 Whether this module has declared itself unimportable, either because it's missing a requirement from Requirements or because it's been shadowed by another module.
 
unsigned HasIncompatibleModuleFile: 1
 Whether we tried and failed to load a module file for this module.
 
unsigned IsAvailable: 1
 Whether this module is available in the current translation unit.
 
unsigned IsFromModuleFile: 1
 Whether this module was loaded from a module file.
 
unsigned IsFramework: 1
 Whether this is a framework module.
 
unsigned IsExplicit: 1
 Whether this is an explicit submodule.
 
unsigned IsSystem: 1
 Whether this is a "system" module (which assumes that all headers in it are system headers).
 
unsigned IsExternC: 1
 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).
 
unsigned IsInferred: 1
 Whether this is an inferred submodule (module * { ... }).
 
unsigned InferSubmodules: 1
 Whether we should infer submodules for this module based on the headers.
 
unsigned InferExplicitSubmodules: 1
 Whether, when inferring submodules, the inferred submodules should be explicit.
 
unsigned InferExportWildcard: 1
 Whether, when inferring submodules, the inferr submodules should export all modules they import (e.g., the equivalent of "export *").
 
unsigned ConfigMacrosExhaustive: 1
 Whether the set of configuration macros is exhaustive.
 
unsigned NoUndeclaredIncludes: 1
 Whether files in this module can only include non-modular headers and headers from used modules.
 
unsigned ModuleMapIsPrivate: 1
 Whether this module came from a "private" module map, found next to a regular (public) module map.
 
NameVisibilityKind NameVisibility
 The visibility of names within this particular module.
 
SourceLocation InferredSubmoduleLoc
 The location of the inferred submodule.
 
llvm::SmallSetVector< Module *, 2 > Imports
 The set of modules imported by this module, and on which this module depends.
 
llvm::SmallSetVector< Module *, 2 > AffectingClangModules
 The set of top-level modules that affected the compilation of this module, but were not imported.
 
SmallVector< ExportDecl, 2 > Exports
 The set of export declarations.
 
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
 The set of export declarations that have yet to be resolved.
 
SmallVector< Module *, 2 > DirectUses
 The directly used modules.
 
SmallVector< ModuleId, 2 > UnresolvedDirectUses
 The set of use declarations that have yet to be resolved.
 
llvm::SmallSetVector< const Module *, 2 > UndeclaredUses
 When NoUndeclaredIncludes is true, the set of modules this module tried to import but didn't because they are not direct uses.
 
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
 The set of libraries or frameworks to link against when an entity from this module is used.
 
bool UseExportAsModuleLinkName = false
 Autolinking uses the framework name for linking purposes when this is false and the export_as name otherwise.
 
std::vector< std::string > ConfigMacros
 The set of "configuration macros", which are macros that (intentionally) change how this module is built.
 
std::vector< UnresolvedConflictUnresolvedConflicts
 The list of conflicts for which the module-id has not yet been resolved.
 
std::vector< ConflictConflicts
 The list of conflicts.
 

Static Public Attributes

static const int NumHeaderKinds = HK_Excluded + 1
 

Detailed Description

Describes a module or submodule.

Aligned to 8 bytes to allow for llvm::PointerIntPair<Module *, 3>.

Definition at line 98 of file Module.h.

Member Typedef Documentation

◆ ExportDecl

using clang::Module::ExportDecl = llvm::PointerIntPair<Module *, 1, bool>

Describes an exported module.

The pointer is the module being re-exported, while the bit will be true to indicate that this is a wildcard export.

Definition at line 374 of file Module.h.

◆ Requirement

using clang::Module::Requirement = std::pair<std::string, bool>

An individual requirement: a feature name and a flag indicating the required state of that feature.

Definition at line 272 of file Module.h.

◆ submodule_const_iterator

using clang::Module::submodule_const_iterator = std::vector<Module *>::const_iterator

Definition at line 724 of file Module.h.

◆ submodule_iterator

using clang::Module::submodule_iterator = std::vector<Module *>::iterator

Definition at line 723 of file Module.h.

Member Enumeration Documentation

◆ HeaderKind

Enumerator
HK_Normal 
HK_Textual 
HK_Private 
HK_PrivateTextual 
HK_Excluded 

Definition at line 218 of file Module.h.

◆ ModuleKind

Enumerator
ModuleMapModule 

This is a module that was defined by a module map and built out of header files.

ModuleInterfaceUnit 

This is a C++20 module interface unit.

ModuleHeaderUnit 

This is a C++ 20 header unit.

ModulePartitionInterface 

This is a C++ 20 module partition interface.

ModulePartitionImplementation 

This is a C++ 20 module partition implementation.

ExplicitGlobalModuleFragment 

This is the explicit Global Module Fragment of a modular TU.

As per C++ [module.global.frag].

PrivateModuleFragment 

This is the private module fragment within some C++ module.

ImplicitGlobalModuleFragment 

This is an implicit fragment of the global module which contains only language linkage declarations (made in the purview of the named module).

Definition at line 106 of file Module.h.

◆ NameVisibilityKind

Describes the visibility of the various names within a particular module.

Enumerator
Hidden 

All of the names in this module are hidden.

AllVisible 

All of the names in this module are visible.

Definition at line 349 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

Module::Module ( StringRef  Name,
SourceLocation  DefinitionLoc,
Module Parent,
bool  IsFramework,
bool  IsExplicit,
unsigned  VisibilityID 
)

Construct a new module or submodule.

Definition at line 37 of file Module.cpp.

References IsAvailable, isAvailable(), IsExternC, IsSystem, IsUnimportable, isUnimportable(), ModuleMapIsPrivate, Name, NoUndeclaredIncludes, and Parent.

◆ ~Module()

Module::~Module ( )

Definition at line 61 of file Module.cpp.

References submodule_begin(), and submodule_end().

Member Function Documentation

◆ addRequirement()

void Module::addRequirement ( StringRef  Feature,
bool  RequiredState,
const LangOptions LangOpts,
const TargetInfo Target 
)

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

Parameters
FeatureThe feature that is required by this module (and its submodules).
RequiredStateThe required state of this feature: true if it must be present, false if it must be absent.
LangOptsThe set of language options that will be used to evaluate the availability of this feature.
TargetThe target options that will be used to evaluate the availability of this feature.

Definition at line 311 of file Module.cpp.

References hasFeature(), markUnavailable(), Requirements, and clang::Target.

◆ addTopHeader()

void Module::addTopHeader ( const FileEntry File)

Add a top-level header associated with this module.

Definition at line 272 of file Module.cpp.

References clang::File.

Referenced by collectModuleHeaderIncludes().

◆ addTopHeaderFilename()

void clang::Module::addTopHeaderFilename ( StringRef  Filename)
inline

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

Definition at line 659 of file Module.h.

References Filename.

◆ directlyUses()

bool Module::directlyUses ( const Module Requested)

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

Definition at line 290 of file Module.cpp.

References getTopLevelModule(), isSubModuleOf(), Name, NoUndeclaredIncludes, Parent, and UndeclaredUses.

Referenced by clang::ModuleMap::diagnoseHeaderInclusion(), and suggestModule().

◆ dump()

LLVM_DUMP_METHOD void Module::dump ( ) const

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

Definition at line 577 of file APINotesYAMLCompiler.cpp.

◆ findOrInferSubmodule()

Module * Module::findOrInferSubmodule ( StringRef  Name)

◆ findSubmodule()

Module * Module::findSubmodule ( StringRef  Name) const

Find the submodule with the given name.

Returns
The submodule if found, or NULL otherwise.

Definition at line 351 of file Module.cpp.

References Name.

Referenced by getGlobalModuleFragment(), getPrivateModuleFragment(), and clang::CompilerInstance::loadModule().

◆ fullModuleNameIs()

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

Whether the full name of this module is equal to joining nameParts with "."s.

This is more efficient than getFullModuleName().

Definition at line 255 of file Module.cpp.

References Parent.

Referenced by shouldAddRequirement().

◆ getASTFile()

OptionalFileEntryRefDegradesToFileEntryPtr clang::Module::getASTFile ( ) const
inline

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

Definition at line 626 of file Module.h.

References getTopLevelModule().

Referenced by clang::ASTSourceDescriptor::ASTSourceDescriptor(), clang::CompilerInstance::loadGlobalModuleIndex(), and setASTFile().

◆ getExportedModules()

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

Appends this module's list of exported modules to Exported.

This provides a subset of immediately imported modules (the ones that are directly exported), not the complete set of exported modules.

Definition at line 374 of file Module.cpp.

References Exports, Imports, IsExplicit, and isSubModuleOf().

Referenced by clang::ASTReader::makeModuleVisible().

◆ getFullModuleName()

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

◆ getGlobalModuleFragment()

Module * clang::Module::getGlobalModuleFragment ( )
inline

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

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

Definition at line 701 of file Module.h.

References findSubmodule().

◆ getModuleInputBufferName()

static StringRef clang::Module::getModuleInputBufferName ( )
inlinestatic

Definition at line 744 of file Module.h.

Referenced by getInputBufferForModule().

◆ getPrimaryModuleInterfaceName()

StringRef clang::Module::getPrimaryModuleInterfaceName ( ) const
inline

Get the primary module interface name from a partition.

Definition at line 576 of file Module.h.

References getTopLevelModuleName(), isGlobalModule(), isModulePartition(), isPrivateModule(), and Name.

Referenced by clang::Sema::ActOnModuleImport(), and clang::Sema::CheckRedeclarationModuleOwnership().

◆ getPrivateModuleFragment()

Module * clang::Module::getPrivateModuleFragment ( )
inline

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

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

Definition at line 707 of file Module.h.

References findSubmodule().

◆ getTopHeaders()

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

The top-level headers associated with this module.

Definition at line 277 of file Module.cpp.

References clang::FileManager::getFile().

◆ getTopLevelModule() [1/2]

Module * clang::Module::getTopLevelModule ( )
inline

◆ getTopLevelModule() [2/2]

const Module * Module::getTopLevelModule ( ) const

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

Definition at line 201 of file Module.cpp.

References clang::Result.

◆ getTopLevelModuleName()

StringRef clang::Module::getTopLevelModuleName ( ) const
inline

Retrieve the name of the top-level module.

Definition at line 621 of file Module.h.

References getTopLevelModule(), and Name.

Referenced by clang::Sema::ArgumentDependentLookup(), compileModule(), getPrimaryModuleInterfaceName(), isForBuilding(), and clang::Preprocessor::LeaveSubmodule().

◆ getUmbrellaDir()

Module::DirectoryName Module::getUmbrellaDir ( ) const

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

Definition at line 264 of file Module.cpp.

References getUmbrellaHeader(), Umbrella, UmbrellaAsWritten, and UmbrellaRelativeToRootModuleDirectory.

Referenced by collectModuleHeaderIncludes(), clang::ModuleMap::isHeaderUnavailableInModule(), and print().

◆ getUmbrellaHeader()

Header clang::Module::getUmbrellaHeader ( ) const
inline

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

Definition at line 642 of file Module.h.

References Umbrella, UmbrellaAsWritten, and UmbrellaRelativeToRootModuleDirectory.

Referenced by collectAllSubModulesWithUmbrellaHeader(), collectModuleHeaderIncludes(), getInputBufferForModule(), getUmbrellaDir(), and print().

◆ getVisibilityID()

unsigned clang::Module::getVisibilityID ( ) const
inline

Definition at line 721 of file Module.h.

Referenced by clang::VisibleModuleSet::getImportLoc().

◆ hasUmbrellaDir()

bool clang::Module::hasUmbrellaDir ( ) const
inline

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

Definition at line 651 of file Module.h.

References Umbrella.

◆ isAvailable() [1/2]

bool clang::Module::isAvailable ( ) const
inline

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

Definition at line 491 of file Module.h.

References IsAvailable.

Referenced by clang::Preprocessor::checkModuleIsAvailable(), collectModuleHeaderIncludes(), clang::ModuleMap::KnownHeader::isAvailable(), isBetterKnownHeader(), clang::ModuleMap::isHeaderUnavailableInModule(), and Module().

◆ isAvailable() [2/2]

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

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

Parameters
LangOptsThe language options used for the current translation unit.
TargetThe target options used for the current translation unit.
ReqIf 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.
MissingHeaderIf this module is unavailable because of a missing header, this parameter will be set to one of the missing headers.
ShadowingModuleIf this module is unavailable because it is shadowed, this parameter will be set to the shadowing module.

Definition at line 171 of file Module.cpp.

References IsAvailable, isUnimportable(), ShadowingModule, and clang::Target.

◆ isExplicitGlobalModule()

bool clang::Module::isExplicitGlobalModule ( ) const
inline

Definition at line 182 of file Module.h.

References ExplicitGlobalModuleFragment, and Kind.

Referenced by isGlobalModule().

◆ isForBuilding()

bool Module::isForBuilding ( const LangOptions LangOpts) const

Determine whether this module can be built in this compilation.

Definition at line 157 of file Module.cpp.

References clang::LangOptions::CurrentModule, getTopLevelModule(), getTopLevelModuleName(), IsFramework, and clang::LangOptions::ModuleName.

Referenced by clang::Sema::ActOnModuleImport().

◆ isGlobalModule()

bool clang::Module::isGlobalModule ( ) const
inline

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

Definition at line 179 of file Module.h.

References isExplicitGlobalModule(), and isImplicitGlobalModule().

Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::diagnoseMissingImport(), getPrimaryModuleInterfaceName(), clang::Sema::isModuleVisible(), and clang::VisibleModuleSet::setVisible().

◆ isHeaderLikeModule()

bool clang::Module::isHeaderLikeModule ( ) const
inline

Is this module have similar semantics as headers.

Definition at line 554 of file Module.h.

References isHeaderUnit(), and isModuleMapModule().

Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::IsRedefinitionInModule(), and clang::CodeGen::CodeGenModule::Release().

◆ isHeaderUnit()

bool clang::Module::isHeaderUnit ( ) const
inline

Is this module a header unit.

Definition at line 565 of file Module.h.

References Kind, and ModuleHeaderUnit.

Referenced by isHeaderLikeModule(), and clang::Parser::ParseTopLevelDecl().

◆ isImplicitGlobalModule()

bool clang::Module::isImplicitGlobalModule ( ) const
inline

Definition at line 185 of file Module.h.

References ImplicitGlobalModuleFragment, and Kind.

Referenced by isGlobalModule().

◆ isInterfaceOrPartition()

bool clang::Module::isInterfaceOrPartition ( ) const
inline

◆ isModuleInterfaceUnit()

bool clang::Module::isModuleInterfaceUnit ( ) const
inline

Definition at line 571 of file Module.h.

References Kind, ModuleInterfaceUnit, and ModulePartitionInterface.

◆ isModuleMapModule()

bool clang::Module::isModuleMapModule ( ) const
inline

Definition at line 191 of file Module.h.

References Kind, and ModuleMapModule.

Referenced by isHeaderLikeModule(), and clang::Preprocessor::markClangModuleAsAffecting().

◆ isModulePartition()

bool clang::Module::isModulePartition ( ) const
inline

◆ isModulePurview()

bool clang::Module::isModulePurview ( ) const
inline

◆ isModuleVisible()

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

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.

Definition at line 715 of file Module.h.

Referenced by clang::Sema::isModuleVisible().

◆ isPartOfFramework()

bool clang::Module::isPartOfFramework ( ) const
inline

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.

Definition at line 530 of file Module.h.

References Parent.

Referenced by isSubFramework().

◆ isPrivateModule()

bool clang::Module::isPrivateModule ( ) const
inline

◆ isSubFramework()

bool clang::Module::isSubFramework ( ) const
inline

Determine whether this module is a subframework of another framework.

Definition at line 540 of file Module.h.

References IsFramework, isPartOfFramework(), and Parent.

Referenced by inferFrameworkLink().

◆ isSubModule()

bool clang::Module::isSubModule ( ) const
inline

Determine whether this module is a submodule.

Definition at line 517 of file Module.h.

References Parent.

◆ isSubModuleOf()

bool Module::isSubModuleOf ( const Module Other) const

Check if this module is a (possibly transitive) submodule of Other.

The 'A is a submodule of B' relation is a partial order based on the the parent-child relationship between individual modules.

Returns false if Other is nullptr.

Definition at line 193 of file Module.cpp.

References Parent.

Referenced by directlyUses(), getExportedModules(), clang::ModuleMap::isHeaderUnavailableInModule(), and clang::Sema::isModuleUnitOfCurrentTU().

◆ isUnimportable() [1/2]

bool clang::Module::isUnimportable ( ) const
inline

Determine whether this module has been declared unimportable.

Definition at line 468 of file Module.h.

References IsUnimportable.

Referenced by isAvailable(), clang::ASTReader::makeModuleVisible(), and Module().

◆ isUnimportable() [2/2]

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

Determine whether this module has been declared unimportable.

Parameters
LangOptsThe language options used for the current translation unit.
TargetThe target options used for the current translation unit.
ReqIf 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.
ShadowingModuleIf this module is unimportable because it is shadowed, this parameter will be set to the shadowing module.

Definition at line 128 of file Module.cpp.

References hasFeature(), IsUnimportable, ShadowingModule, and clang::Target.

◆ markUnavailable()

void Module::markUnavailable ( bool  Unimportable)

Mark this module and all of its submodules as unavailable.

Definition at line 323 of file Module.cpp.

Referenced by addRequirement().

◆ print()

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

◆ setASTFile()

void clang::Module::setASTFile ( OptionalFileEntryRef  File)
inline

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

Definition at line 631 of file Module.h.

References clang::File, getASTFile(), and getTopLevelModule().

◆ setParent()

void clang::Module::setParent ( Module M)
inline

Set the parent of this module.

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

Definition at line 546 of file Module.h.

References Name, and Parent.

◆ submodule_begin() [1/2]

submodule_iterator clang::Module::submodule_begin ( )
inline

◆ submodule_begin() [2/2]

submodule_const_iterator clang::Module::submodule_begin ( ) const
inline

Definition at line 727 of file Module.h.

◆ submodule_end() [1/2]

submodule_iterator clang::Module::submodule_end ( )
inline

◆ submodule_end() [2/2]

submodule_const_iterator clang::Module::submodule_end ( ) const
inline

Definition at line 729 of file Module.h.

◆ submodules() [1/2]

llvm::iterator_range< submodule_iterator > clang::Module::submodules ( )
inline

◆ submodules() [2/2]

llvm::iterator_range< submodule_const_iterator > clang::Module::submodules ( ) const
inline

Definition at line 734 of file Module.h.

References submodule_begin(), and submodule_end().

Member Data Documentation

◆ AffectingClangModules

llvm::SmallSetVector<Module *, 2> clang::Module::AffectingClangModules

The set of top-level modules that affected the compilation of this module, but were not imported.

Definition at line 368 of file Module.h.

◆ ConfigMacros

std::vector<std::string> clang::Module::ConfigMacros

The set of "configuration macros", which are macros that (intentionally) change how this module is built.

Definition at line 434 of file Module.h.

Referenced by clang::CompilerInstance::loadModule(), and print().

◆ ConfigMacrosExhaustive

unsigned clang::Module::ConfigMacrosExhaustive

Whether the set of configuration macros is exhaustive.

When the set of configuration macros is exhaustive, meaning that no identifier not in this list should affect how the module is built.

Definition at line 337 of file Module.h.

Referenced by print().

◆ Conflicts

std::vector<Conflict> clang::Module::Conflicts

The list of conflicts.

Definition at line 459 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveConflicts().

◆ DefinitionLoc

SourceLocation clang::Module::DefinitionLoc

◆ Directory

const DirectoryEntry* clang::Module::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.

Definition at line 146 of file Module.h.

Referenced by clang::ASTSourceDescriptor::ASTSourceDescriptor(), compileModule(), and prepareToBuildModule().

◆ DirectUses

SmallVector<Module *, 2> clang::Module::DirectUses

The directly used modules.

Definition at line 398 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveUses().

◆ ExportAsModule

std::string clang::Module::ExportAsModule

The module through which entities defined in this module will eventually be exposed, for use in "private" modules.

Definition at line 167 of file Module.h.

Referenced by clang::ModuleMap::addLinkAsDependency(), and print().

◆ Exports

SmallVector<ExportDecl, 2> clang::Module::Exports

◆ HasIncompatibleModuleFile

unsigned clang::Module::HasIncompatibleModuleFile

Whether we tried and failed to load a module file for this module.

Definition at line 289 of file Module.h.

◆ Headers

SmallVector<Header, 2> clang::Module::Headers[5]

The headers that are part of this module.

Definition at line 248 of file Module.h.

Referenced by clang::ModuleMap::addHeader(), collectModuleHeaderIncludes(), print(), and violatesPrivateInclude().

◆ Imports

llvm::SmallSetVector<Module *, 2> clang::Module::Imports

The set of modules imported by this module, and on which this module depends.

Definition at line 364 of file Module.h.

Referenced by clang::Sema::ActOnModuleImport(), addLinkOptionsPostorder(), clang::DumpModuleInfoAction::ExecuteAction(), getExportedModules(), and print().

◆ InferExplicitSubmodules

unsigned clang::Module::InferExplicitSubmodules

Whether, when inferring submodules, the inferred submodules should be explicit.

Definition at line 326 of file Module.h.

Referenced by findOrInferSubmodule(), and print().

◆ InferExportWildcard

unsigned clang::Module::InferExportWildcard

Whether, when inferring submodules, the inferr submodules should export all modules they import (e.g., the equivalent of "export *").

Definition at line 330 of file Module.h.

Referenced by findOrInferSubmodule(), and print().

◆ InferredSubmoduleLoc

SourceLocation clang::Module::InferredSubmoduleLoc

The location of the inferred submodule.

Definition at line 360 of file Module.h.

◆ InferSubmodules

unsigned clang::Module::InferSubmodules

Whether we should infer submodules for this module based on the headers.

Submodules can only be inferred for modules with an umbrella header.

Definition at line 322 of file Module.h.

Referenced by findOrInferSubmodule(), clang::ModuleMap::isHeaderUnavailableInModule(), and print().

◆ IsAvailable

unsigned clang::Module::IsAvailable

Whether this module is available in the current translation unit.

If the module is missing headers or does not meet all requirements then this bit will be 0.

Definition at line 295 of file Module.h.

Referenced by isAvailable(), and Module().

◆ IsExplicit

unsigned clang::Module::IsExplicit

Whether this is an explicit submodule.

Definition at line 304 of file Module.h.

Referenced by getExportedModules(), and print().

◆ IsExternC

unsigned clang::Module::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).

Definition at line 313 of file Module.h.

Referenced by checkModuleImportContext(), collectModuleHeaderIncludes(), getInputBufferForModule(), Module(), and print().

◆ IsFramework

unsigned clang::Module::IsFramework

Whether this is a framework module.

Definition at line 301 of file Module.h.

Referenced by appendSubframeworkPaths(), clang::ModuleMap::diagnoseHeaderInclusion(), inferFrameworkLink(), isForBuilding(), isSubFramework(), and print().

◆ IsFromModuleFile

unsigned clang::Module::IsFromModuleFile

Whether this module was loaded from a module file.

Definition at line 298 of file Module.h.

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

◆ IsInferred

unsigned clang::Module::IsInferred

Whether this is an inferred submodule (module * { ... }).

Definition at line 316 of file Module.h.

Referenced by clang::ModuleMap::getModuleMapFileForUniquing(), prepareToBuildModule(), and clang::ModuleMap::setInferredModuleAllowedBy().

◆ IsSystem

unsigned clang::Module::IsSystem

Whether this is a "system" module (which assumes that all headers in it are system headers).

Definition at line 308 of file Module.h.

Referenced by compileModule(), clang::ModuleMap::inferFrameworkModule(), clang::Preprocessor::LookupFile(), Module(), print(), and clang::PCHValidator::ReadDiagnosticOptions().

◆ IsUnimportable

unsigned clang::Module::IsUnimportable

Whether this module has declared itself unimportable, either because it's missing a requirement from Requirements or because it's been shadowed by another module.

Definition at line 286 of file Module.h.

Referenced by isUnimportable(), and Module().

◆ Kind

ModuleKind clang::Module::Kind = ModuleMapModule

◆ LinkLibraries

llvm::SmallVector<LinkLibrary, 2> clang::Module::LinkLibraries

The set of libraries or frameworks to link against when an entity from this module is used.

Definition at line 426 of file Module.h.

Referenced by addLinkOptionsPostorder(), inferFrameworkLink(), and print().

◆ MissingHeaders

SmallVector<UnresolvedHeaderDirective, 1> clang::Module::MissingHeaders

Headers that are mentioned in the module map file but could not be found on the file system.

Definition at line 268 of file Module.h.

Referenced by collectModuleHeaderIncludes(), and print().

◆ ModuleMapIsPrivate

unsigned clang::Module::ModuleMapIsPrivate

Whether this module came from a "private" module map, found next to a regular (public) module map.

Definition at line 345 of file Module.h.

Referenced by Module().

◆ Name

std::string clang::Module::Name

◆ NameVisibility

NameVisibilityKind clang::Module::NameVisibility

The visibility of names within this particular module.

Definition at line 357 of file Module.h.

Referenced by clang::ASTReader::makeModuleVisible(), and clang::ASTReader::makeNamesVisible().

◆ NoUndeclaredIncludes

unsigned clang::Module::NoUndeclaredIncludes

Whether files in this module can only include non-modular headers and headers from used modules.

Definition at line 341 of file Module.h.

Referenced by directlyUses(), Module(), needModuleLookup(), and suggestModule().

◆ NumHeaderKinds

const int clang::Module::NumHeaderKinds = HK_Excluded + 1
static

Definition at line 225 of file Module.h.

◆ Parent

Module* clang::Module::Parent

◆ PresumedModuleMapFile

std::string clang::Module::PresumedModuleMapFile

The presumed file name for the module map defining this module.

Only non-empty when building from preprocessed source.

Definition at line 150 of file Module.h.

Referenced by clang::FrontendAction::BeginSourceFile().

◆ Requirements

SmallVector<Requirement, 2> clang::Module::Requirements

The set of language features required to use this module.

If any of these requirements are not available, the IsAvailable bit will be false to indicate that this (sub)module is not available.

Definition at line 278 of file Module.h.

Referenced by addRequirement(), and print().

◆ ShadowingModule

Module* clang::Module::ShadowingModule = nullptr

A module with the same name that shadows this module.

Definition at line 281 of file Module.h.

Referenced by isAvailable(), and isUnimportable().

◆ Signature

ASTFileSignature clang::Module::Signature

The module signature.

Definition at line 157 of file Module.h.

◆ Umbrella

llvm::PointerUnion<const FileEntryRef::MapEntry *, const DirectoryEntry *> clang::Module::Umbrella

The umbrella header or directory.

Definition at line 154 of file Module.h.

Referenced by getUmbrellaDir(), getUmbrellaHeader(), hasUmbrellaDir(), clang::ModuleMap::setUmbrellaDir(), and clang::ModuleMap::setUmbrellaHeader().

◆ UmbrellaAsWritten

std::string clang::Module::UmbrellaAsWritten

The name of the umbrella entry, as written in the module map.

Definition at line 160 of file Module.h.

Referenced by getUmbrellaDir(), getUmbrellaHeader(), clang::ModuleMap::setUmbrellaDir(), and clang::ModuleMap::setUmbrellaHeader().

◆ UmbrellaRelativeToRootModuleDirectory

std::string clang::Module::UmbrellaRelativeToRootModuleDirectory

◆ UndeclaredUses

llvm::SmallSetVector<const Module *, 2> clang::Module::UndeclaredUses

When NoUndeclaredIncludes is true, the set of modules this module tried to import but didn't because they are not direct uses.

Definition at line 405 of file Module.h.

Referenced by directlyUses().

◆ UnresolvedConflicts

std::vector<UnresolvedConflict> clang::Module::UnresolvedConflicts

The list of conflicts for which the module-id has not yet been resolved.

Definition at line 447 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveConflicts().

◆ UnresolvedDirectUses

SmallVector<ModuleId, 2> clang::Module::UnresolvedDirectUses

The set of use declarations that have yet to be resolved.

Definition at line 401 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveUses().

◆ UnresolvedExports

SmallVector<UnresolvedExportDecl, 2> clang::Module::UnresolvedExports

The set of export declarations that have yet to be resolved.

Definition at line 395 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveExports().

◆ UnresolvedHeaders

SmallVector<UnresolvedHeaderDirective, 1> clang::Module::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.

Definition at line 264 of file Module.h.

Referenced by print(), and clang::ModuleMap::resolveHeaderDirectives().

◆ UseExportAsModuleLinkName

bool clang::Module::UseExportAsModuleLinkName = false

Autolinking uses the framework name for linking purposes when this is false and the export_as name otherwise.

Definition at line 430 of file Module.h.

Referenced by clang::ModuleMap::addLinkAsDependency(), and addLinkOptionsPostorder().


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