clang API Documentation

Classes | Public Types | Public Member Functions | Public Attributes
clang::Module Class Reference

Describes a module or submodule. More...

#include <Module.h>

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

List of all members.

Classes

struct  UnresolvedExportDecl
 Describes an exported module that has not yet been resolved (perhaps because tASThe module it refers to has not yet been loaded). More...

Public Types

enum  NameVisibilityKind { Hidden, MacrosVisible, AllVisible }
 Describes the visibility of the various names within a particular module. More...
typedef llvm::PointerIntPair
< Module *, 1, bool > 
ExportDecl
 Describes an exported module.
typedef std::vector< Module * >
::iterator 
submodule_iterator
typedef std::vector< Module * >
::const_iterator 
submodule_const_iterator

Public Member Functions

 Module (StringRef Name, SourceLocation DefinitionLoc, bool IsFramework)
 Construct a top-level module.
 Module (StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit)
 Construct a new module or submodule.
 ~Module ()
bool isAvailable () const
 Determine whether this module is available for use within the current translation unit.
bool isAvailable (const LangOptions &LangOpts, const TargetInfo &Target, StringRef &Feature) 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 (Module *Other) const
 Determine whether this module is a submodule of the given other module.
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.
std::string getFullModuleName () const
 Retrieve the full name of this module, including the path from its top-level module.
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.
const DirectoryEntrygetUmbrellaDir () const
 Retrieve the directory for which this module serves as the umbrella.
const FileEntrygetUmbrellaHeader () 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 addRequirement (StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
ModulefindSubmodule (StringRef Name) const
 Find the submodule with the given name.
submodule_iterator submodule_begin ()
submodule_const_iterator submodule_begin () const
submodule_iterator submodule_end ()
submodule_const_iterator submodule_end () const
void print (llvm::raw_ostream &OS, unsigned Indent=0) 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.

Public Attributes

std::string Name
 The name of this module.
SourceLocation DefinitionLoc
 The location of the module definition.
ModuleParent
 The parent of this module. This will be NULL for the top-level module.
llvm::PointerUnion< const
DirectoryEntry *, const
FileEntry * > 
Umbrella
 The umbrella header or directory.
llvm::SmallVector< const
FileEntry *, 2 > 
Headers
 The headers that are part of this module.
llvm::SmallVector< std::string, 2 > Requires
 The set of language features required to use 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 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 *").
NameVisibilityKind NameVisibility
 \ brief The visibility of names within this particular module.
SourceLocation InferredSubmoduleLoc
 The location of the inferred submodule.
llvm::SmallVector< Module *, 2 > Imports
 The set of modules imported by this module, and on which this module depends.
llvm::SmallVector< ExportDecl, 2 > Exports
 The set of export declarations.
llvm::SmallVector
< UnresolvedExportDecl, 2 > 
UnresolvedExports
 The set of export declarations that have yet to be resolved.

Detailed Description

Describes a module or submodule.

Definition at line 43 of file Basic/Module.h.


Member Typedef Documentation

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

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 134 of file Basic/Module.h.

typedef std::vector<Module *>::const_iterator clang::Module::submodule_const_iterator

Definition at line 266 of file Basic/Module.h.

typedef std::vector<Module *>::iterator clang::Module::submodule_iterator

Definition at line 265 of file Basic/Module.h.


Member Enumeration Documentation

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

Enumerator:
Hidden 

All of the names in this module are hidden.

MacrosVisible 

Only the macro names in this module are visible.

AllVisible 

All of the names in this module are visible.

Definition at line 110 of file Basic/Module.h.


Constructor & Destructor Documentation

clang::Module::Module ( StringRef  Name,
SourceLocation  DefinitionLoc,
bool  IsFramework 
) [inline, explicit]

Construct a top-level module.

Definition at line 158 of file Basic/Module.h.

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

Construct a new module or submodule.

Definition at line 24 of file Basic/Module.cpp.

References IsAvailable, isAvailable(), IsSystem, and Name.

Module::~Module ( )

Definition at line 43 of file Basic/Module.cpp.

References submodule_begin(), and submodule_end().


Member Function Documentation

void Module::addRequirement ( StringRef  Feature,
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).
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 132 of file Basic/Module.cpp.

References hasFeature(), IsAvailable, Requires, submodule_begin(), and submodule_end().

void Module::dump ( ) const

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

Definition at line 270 of file Basic/Module.cpp.

References print().

Module * Module::findSubmodule ( StringRef  Name) const

Find the submodule with the given name.

Returns:
The submodule if found, or NULL otherwise.

Definition at line 162 of file Basic/Module.cpp.

Referenced by clang::CompilerInstance::loadModule(), and clang::ModuleMap::lookupModuleQualified().

std::string Module::getFullModuleName ( ) const

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

Definition at line 105 of file Basic/Module.cpp.

References Parent.

Referenced by clang::GenerateModuleAction::BeginSourceFileAction(), and clang::CompilerInstance::loadModule().

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

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

Definition at line 215 of file Basic/Module.h.

Referenced by clang::HeaderSearch::getModuleFileName(), and getTopLevelModuleName().

const Module * Module::getTopLevelModule ( ) const

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

Definition at line 97 of file Basic/Module.cpp.

References Parent.

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

Retrieve the name of the top-level module.

Definition at line 226 of file Basic/Module.h.

References getTopLevelModule(), and Name.

Referenced by compileModule().

const DirectoryEntry * Module::getUmbrellaDir ( ) const

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

Definition at line 125 of file Basic/Module.cpp.

References getUmbrellaHeader(), and Umbrella.

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

const FileEntry* clang::Module::getUmbrellaHeader ( ) const [inline]

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

Definition at line 236 of file Basic/Module.h.

References Umbrella.

Referenced by clang::GenerateModuleAction::BeginSourceFileAction(), collectModuleHeaderIncludes(), getUmbrellaDir(), and print().

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 242 of file Basic/Module.h.

References Umbrella.

bool clang::Module::isAvailable ( ) const [inline]
bool Module::isAvailable ( const LangOptions LangOpts,
const TargetInfo Target,
StringRef &  Feature 
) 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.
FeatureIf this module is unavailable, this parameter will be set to one of the features that is required for use of this module (but is not available).

Definition at line 68 of file Basic/Module.cpp.

References hasFeature(), IsAvailable, and Parent.

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 201 of file Basic/Module.h.

References Parent.

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

Determine whether this module is a submodule.

Definition at line 192 of file Basic/Module.h.

References Parent.

bool Module::isSubModuleOf ( Module Other) const

Determine whether this module is a submodule of the given other module.

Definition at line 85 of file Basic/Module.cpp.

References Parent.

Referenced by clang::ASTWriter::inferSubmoduleIDFromLocation(), and clang::ASTReader::makeModuleVisible().

void Module::print ( llvm::raw_ostream &  OS,
unsigned  Indent = 0 
) const
submodule_iterator clang::Module::submodule_begin ( ) [inline]
submodule_const_iterator clang::Module::submodule_begin ( ) const [inline]

Definition at line 269 of file Basic/Module.h.

submodule_iterator clang::Module::submodule_end ( ) [inline]
submodule_const_iterator clang::Module::submodule_end ( ) const [inline]

Definition at line 271 of file Basic/Module.h.


Member Data Documentation

The location of the module definition.

Definition at line 49 of file Basic/Module.h.

Referenced by clang::ModuleMap::getContainingModuleMapFile().

llvm::SmallVector<ExportDecl, 2> clang::Module::Exports
llvm::SmallVector<const FileEntry *, 2> clang::Module::Headers

The headers that are part of this module.

Definition at line 68 of file Basic/Module.h.

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

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

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

Definition at line 128 of file Basic/Module.h.

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

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

Definition at line 102 of file Basic/Module.h.

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

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

Definition at line 106 of file Basic/Module.h.

Referenced by clang::ModuleMap::findModuleForHeader(), clang::ModuleMap::inferFrameworkModule(), and print().

The location of the inferred submodule.

Definition at line 124 of file Basic/Module.h.

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 98 of file Basic/Module.h.

Referenced by clang::ModuleMap::findModuleForHeader(), clang::ModuleMap::inferFrameworkModule(), clang::ModuleMap::isHeaderInUnavailableModule(), and print().

Whether this module is available in the current translation unit.

Definition at line 79 of file Basic/Module.h.

Referenced by addRequirement(), isAvailable(), and Module().

Whether this is an explicit submodule.

Definition at line 88 of file Basic/Module.h.

Referenced by print().

Whether this is a framework module.

Definition at line 85 of file Basic/Module.h.

Referenced by appendSubframeworkPaths(), and print().

Whether this module was loaded from a module file.

Definition at line 82 of file Basic/Module.h.

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

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

Definition at line 92 of file Basic/Module.h.

Referenced by clang::GenerateModuleAction::BeginSourceFileAction(), clang::ModuleMap::inferFrameworkModule(), Module(), and print().

std::string clang::Module::Name

\ brief The visibility of names within this particular module.

Definition at line 121 of file Basic/Module.h.

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

llvm::SmallVector<std::string, 2> clang::Module::Requires

The set of language features required to use this module.

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

Definition at line 75 of file Basic/Module.h.

Referenced by addRequirement(), and print().

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

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

Definition at line 155 of file Basic/Module.h.

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


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