class ModuleMap

Declaration

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

Declared at: clang/include/clang/Lex/ModuleMap.h:75

Member Variables

private clang::SourceManager& SourceMgr
private clang::DiagnosticsEngine& Diags
private const clang::LangOptions& LangOpts
private const clang::TargetInfo* Target
private clang::HeaderSearch& HeaderInfo
private llvm::SmallVector< std::unique_ptr<ModuleMapCallbacks>, 1> Callbacks
private const clang::DirectoryEntry* BuiltinIncludeDir = nullptr
The directory used for Clang-supplied, builtin include headers, such as "stdint.h".
private clang::LangOptions MMapLangOpts
These are always simple C language options.
private clang::Module* SourceModule = nullptr
The module that the main source file is associated with (the module named LangOpts::CurrentModule, if we've loaded it).
private llvm::SmallVector<std::unique_ptr<Module>, 8> PendingSubmodules
Submodules of the current module that have not yet been attached to it. (Ownership is transferred if/when we create an enclosing module.)
private llvm::StringMap<Module*> Modules
The top-level modules that are known.
private llvm::DenseMap<const IdentifierInfo*, Module*> CachedModuleLoads
Module loading cache that includes submodules, indexed by IdentifierInfo. nullptr is stored for modules that are known to fail to load.
private llvm::SmallVector<Module*, 2> ShadowModules
Shadow modules created while building this module map.
private unsigned int NumCreatedModules = 0
The number of modules we have created in total.
private llvm::StringMap<llvm::StringSet<>> PendingLinkAsModule
In case a module has a export_as entry, it might have a pending link name to be determined if that module is imported.
private clang::ModuleMap::HeadersMap Headers
Mapping from each header to the module that owns the contents of that header.
private llvm::DenseMap<off_t, llvm::TinyPtrVector<Module*>> LazyHeadersBySize
Map from file sizes to modules with lazy header directives of that size.
private llvm::DenseMap<time_t, llvm::TinyPtrVector<Module*>> LazyHeadersByModTime
Map from mtimes to modules with lazy header directives with those mtimes.
private llvm::DenseMap<const DirectoryEntry*, Module*> UmbrellaDirs
This mapping is used to map headers that haven't explicitly been named in the module map over to the module that includes them via its umbrella header.
private unsigned int CurrentModuleScopeID = 0
Modules from earlier scopes may shadow modules from later ones. Modules from the same scope may not have the same name.
private llvm::DenseMap<Module*, unsigned int> ModuleScopeIDs
private llvm::DenseMap<const DirectoryEntry*, InferredDirectory> InferredDirectories
A mapping from directories to information about inferring framework modules from within those directories.
private llvm::DenseMap<const Module*, const FileEntry*> InferredModuleAllowedBy
A mapping from an inferred module to the module map that allowed the inference.
private llvm::DenseMap<const Module*, AdditionalModMapsSet> AdditionalModMaps
private llvm::DenseMap<const FileEntry*, bool> ParsedModuleMap
Describes whether we haved parsed a particular file as a module map.

Method Overview

  • public ModuleMap(clang::SourceManager & SourceMgr, clang::DiagnosticsEngine & Diags, const clang::LangOptions & LangOpts, const clang::TargetInfo * Target, clang::HeaderSearch & HeaderInfo)
  • public void addAdditionalModuleMapFile(const clang::Module * M, const clang::FileEntry * ModuleMap)
  • public void addHeader(clang::Module * Mod, Module::Header Header, clang::ModuleMap::ModuleHeaderRole Role, bool Imported = false)
  • public void addLinkAsDependency(clang::Module * Mod)
  • public void addModuleMapCallbacks(std::unique_ptr<ModuleMapCallbacks> Callback)
  • private void addUnresolvedHeader(clang::Module * Mod, Module::UnresolvedHeaderDirective Header, bool & NeedsFramework)
  • public void cacheModuleLoad(const clang::IdentifierInfo & II, clang::Module * M)
  • public bool canInferFrameworkModule(const clang::DirectoryEntry * Dir) const
  • public clang::Module * createGlobalModuleFragmentForModuleUnit(clang::SourceLocation Loc, clang::Module * Parent = nullptr)
  • public clang::Module * createHeaderModule(llvm::StringRef Name, ArrayRef<Module::Header> Headers)
  • public clang::Module * createHeaderUnit(clang::SourceLocation Loc, llvm::StringRef Name, Module::Header H)
  • public clang::Module * createModuleForInterfaceUnit(clang::SourceLocation Loc, llvm::StringRef Name, clang::Module * GlobalModule)
  • public clang::Module * createPrivateModuleFragmentForInterfaceUnit(clang::Module * Parent, clang::SourceLocation Loc)
  • public clang::Module * createShadowedModule(llvm::StringRef Name, bool IsFramework, clang::Module * ShadowingModule)
  • public void diagnoseHeaderInclusion(clang::Module * RequestingModule, bool RequestingModuleIsModuleInterface, clang::SourceLocation FilenameLoc, llvm::StringRef Filename, clang::FileEntryRef File)
  • public void dump()
  • public void excludeHeader(clang::Module * Mod, Module::Header Header)
  • public ArrayRef<clang::ModuleMap::KnownHeader> findAllModulesForHeader(const clang::FileEntry * File)
  • private Optional<clang::FileEntryRef> findHeader(clang::Module * M, const Module::UnresolvedHeaderDirective & Header, SmallVectorImpl<char> & RelativePathName, bool & NeedsFramework)
  • private clang::ModuleMap::KnownHeader findHeaderInUmbrellaDirs(const clang::FileEntry * File, SmallVectorImpl<const clang::DirectoryEntry *> & IntermediateDirs)
  • private HeadersMap::iterator findKnownHeader(const clang::FileEntry * File)
  • public clang::Module * findModule(llvm::StringRef Name) const
  • public clang::ModuleMap::KnownHeader findModuleForHeader(const clang::FileEntry * File, bool AllowTextual = false)
  • public std::pair<Module *, bool> findOrCreateModule(llvm::StringRef Name, clang::Module * Parent, bool IsFramework, bool IsExplicit)
  • private clang::ModuleMap::KnownHeader findOrCreateModuleForHeaderInUmbrellaDir(const clang::FileEntry * File)
  • public ArrayRef<clang::ModuleMap::KnownHeader> findResolvedModulesForHeader(const clang::FileEntry * File) const
  • public void finishModuleDeclarationScope()
  • public clang::ModuleMap::AdditionalModMapsSet * getAdditionalModuleMapFiles(const clang::Module * M)
  • public const clang::DirectoryEntry * getBuiltinDir() const
  • public llvm::Optional<Module *> getCachedModuleLoad(const clang::IdentifierInfo & II)
  • public const clang::FileEntry * getContainingModuleMapFile(const clang::Module * Module) const
  • public const clang::FileEntry * getModuleMapFileForUniquing(const clang::Module * M) const
  • public static clang::ModuleMap::ModuleHeaderRole headerKindToRole(Module::HeaderKind Kind)
  • public static Module::HeaderKind headerRoleToKind(clang::ModuleMap::ModuleHeaderRole Role)
  • public clang::Module * inferFrameworkModule(const clang::DirectoryEntry * FrameworkDir, bool IsSystem, clang::Module * Parent)
  • private clang::Module * inferFrameworkModule(const clang::DirectoryEntry * FrameworkDir, clang::ModuleMap::Attributes Attrs, clang::Module * Parent)
  • public bool isBuiltinHeader(const clang::FileEntry * File)
  • public static bool isBuiltinHeader(llvm::StringRef FileName)
  • private bool isHeaderInUmbrellaDirs(const clang::FileEntry * File)
  • public bool isHeaderInUnavailableModule(const clang::FileEntry * Header) const
  • public bool isHeaderUnavailableInModule(const clang::FileEntry * Header, const clang::Module * RequestingModule) const
  • public clang::Module * lookupModuleQualified(llvm::StringRef Name, clang::Module * Context) const
  • public clang::Module * lookupModuleUnqualified(llvm::StringRef Name, clang::Module * Context) const
  • public bool mayShadowNewModule(clang::Module * ExistingModule)
  • public clang::ModuleMap::module_iterator module_begin() const
  • public clang::ModuleMap::module_iterator module_end() const
  • public llvm::iterator_range<module_iterator> modules() const
  • public bool parseModuleMapFile(const clang::FileEntry * File, bool IsSystem, const clang::DirectoryEntry * HomeDir, clang::FileID ID = clang::FileID(), unsigned int * Offset = nullptr, clang::SourceLocation ExternModuleLoc = clang::SourceLocation())
  • private bool resolveAsBuiltinHeader(clang::Module * M, const Module::UnresolvedHeaderDirective & Header)
  • public bool resolveConflicts(clang::Module * Mod, bool Complain)
  • private Module::ExportDecl resolveExport(clang::Module * Mod, const Module::UnresolvedExportDecl & Unresolved, bool Complain) const
  • public bool resolveExports(clang::Module * Mod, bool Complain)
  • private void resolveHeader(clang::Module * M, const Module::UnresolvedHeaderDirective & Header, bool & NeedsFramework)
  • public void resolveHeaderDirectives(const clang::FileEntry * File) const
  • public void resolveHeaderDirectives(clang::Module * Mod, llvm::Optional<const FileEntry *> File) const
  • public void resolveLinkAsDependencies(clang::Module * Mod)
  • private clang::Module * resolveModuleId(const clang::ModuleId & Id, clang::Module * Mod, bool Complain) const
  • public bool resolveUses(clang::Module * Mod, bool Complain)
  • public void setBuiltinIncludeDir(const clang::DirectoryEntry * Dir)
  • public void setInferredModuleAllowedBy(clang::Module * M, const clang::FileEntry * ModMap)
  • public void setTarget(const clang::TargetInfo & Target)
  • public void setUmbrellaDir(clang::Module * Mod, const clang::DirectoryEntry * UmbrellaDir, const llvm::Twine & NameAsWritten, const llvm::Twine & PathRelativeToRootModuleDirectory)
  • public void setUmbrellaHeader(clang::Module * Mod, const clang::FileEntry * UmbrellaHeader, const llvm::Twine & NameAsWritten, const llvm::Twine & PathRelativeToRootModuleDirectory)
  • public ~ModuleMap()

Methods

ModuleMap(clang::SourceManager& SourceMgr,
          clang::DiagnosticsEngine& Diags,
          const clang::LangOptions& LangOpts,
          const clang::TargetInfo* Target,
          clang::HeaderSearch& HeaderInfo)

Description

Construct a new module map.

Declared at: clang/include/clang/Lex/ModuleMap.h:392

Parameters

clang::SourceManager& SourceMgr
The source manager used to find module files and headers. This source manager should be shared with the header-search mechanism, since they will refer to the same headers.
clang::DiagnosticsEngine& Diags
A diagnostic engine used for diagnostics.
const clang::LangOptions& LangOpts
Language options for this translation unit.
const clang::TargetInfo* Target
The target for this translation unit.
clang::HeaderSearch& HeaderInfo

void addAdditionalModuleMapFile(
    const clang::Module* M,
    const clang::FileEntry* ModuleMap)

Declared at: clang/include/clang/Lex/ModuleMap.h:633

Parameters

const clang::Module* M
const clang::FileEntry* ModuleMap

void addHeader(
    clang::Module* Mod,
    Module::Header Header,
    clang::ModuleMap::ModuleHeaderRole Role,
    bool Imported = false)

Description

Adds this header to the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:679

Parameters

clang::Module* Mod
Module::Header Header
clang::ModuleMap::ModuleHeaderRole Role
The role of the header wrt the module.
bool Imported = false

void addLinkAsDependency(clang::Module* Mod)

Description

Make module to use export_as as the link dependency name if enough information is available or add it to a pending list otherwise.

Declared at: clang/include/clang/Lex/ModuleMap.h:125

Parameters

clang::Module* Mod

void addModuleMapCallbacks(
    std::unique_ptr<ModuleMapCallbacks> Callback)

Description

Add a module map callback.

Declared at: clang/include/clang/Lex/ModuleMap.h:418

Parameters

std::unique_ptr<ModuleMapCallbacks> Callback

void addUnresolvedHeader(
    clang::Module* Mod,
    Module::UnresolvedHeaderDirective Header,
    bool& NeedsFramework)

Description

Add an unresolved header to a module.

Declared at: clang/include/clang/Lex/ModuleMap.h:318

Parameters

clang::Module* Mod
The module in which we're adding the unresolved header directive.
Module::UnresolvedHeaderDirective Header
The unresolved header directive.
bool& NeedsFramework
If Mod is not a framework but a missing header would be found in case Mod was, set it to true. False otherwise.

void cacheModuleLoad(
    const clang::IdentifierInfo& II,
    clang::Module* M)

Description

Cache a module load. M might be nullptr.

Declared at: clang/include/clang/Lex/ModuleMap.h:722

Parameters

const clang::IdentifierInfo& II
clang::Module* M

bool canInferFrameworkModule(
    const clang::DirectoryEntry* Dir) const

Description

Check whether a framework module can be inferred in the given directory.

Declared at: clang/include/clang/Lex/ModuleMap.h:595

Parameters

const clang::DirectoryEntry* Dir

clang::Module*
createGlobalModuleFragmentForModuleUnit(
    clang::SourceLocation Loc,
    clang::Module* Parent = nullptr)

Description

Create a global module fragment for a C++ module unit. We model the global module fragment as a submodule of the module interface unit. Unfortunately, we can't create the module interface unit's Module until later, because we don't know what it will be called usually. See C++20 [module.unit]/7.2 for the case we could know its parent.

Declared at: clang/include/clang/Lex/ModuleMap.h:547

Parameters

clang::SourceLocation Loc
clang::Module* Parent = nullptr

clang::Module* createHeaderModule(
    llvm::StringRef Name,
    ArrayRef<Module::Header> Headers)

Description

Create a header module from the specified list of headers.

Declared at: clang/include/clang/Lex/ModuleMap.h:565

Parameters

llvm::StringRef Name
ArrayRef<Module::Header> Headers

clang::Module* createHeaderUnit(
    clang::SourceLocation Loc,
    llvm::StringRef Name,
    Module::Header H)

Description

Create a C++20 header unit.

Declared at: clang/include/clang/Lex/ModuleMap.h:568

Parameters

clang::SourceLocation Loc
llvm::StringRef Name
Module::Header H

clang::Module* createModuleForInterfaceUnit(
    clang::SourceLocation Loc,
    llvm::StringRef Name,
    clang::Module* GlobalModule)

Description

Create a new module for a C++ module interface unit. The module must not already exist, and will be configured for the current compilation. Note that this also sets the current module to the newly-created module.

Declared at: clang/include/clang/Lex/ModuleMap.h:561

Parameters

clang::SourceLocation Loc
llvm::StringRef Name
clang::Module* GlobalModule

Returns

The newly-created module.

clang::Module*
createPrivateModuleFragmentForInterfaceUnit(
    clang::Module* Parent,
    clang::SourceLocation Loc)

Description

Create a global module fragment for a C++ module interface unit.

Declared at: clang/include/clang/Lex/ModuleMap.h:551

Parameters

clang::Module* Parent
clang::SourceLocation Loc

clang::Module* createShadowedModule(
    llvm::StringRef Name,
    bool IsFramework,
    clang::Module* ShadowingModule)

Description

Create a new top-level module that is shadowed by\p ShadowingModule.

Declared at: clang/include/clang/Lex/ModuleMap.h:578

Parameters

llvm::StringRef Name
bool IsFramework
clang::Module* ShadowingModule

void diagnoseHeaderInclusion(
    clang::Module* RequestingModule,
    bool RequestingModuleIsModuleInterface,
    clang::SourceLocation FilenameLoc,
    llvm::StringRef Filename,
    clang::FileEntryRef File)

Description

Reports errors if a module must not include a specific file.

Declared at: clang/include/clang/Lex/ModuleMap.h:479

Parameters

clang::Module* RequestingModule
The module including a file.
bool RequestingModuleIsModuleInterface
\c true if the inclusion is in the interface of RequestingModule, \c false if it's in the implementation of RequestingModule. Value is ignored and meaningless if RequestingModule is nullptr.
clang::SourceLocation FilenameLoc
The location of the inclusion's filename.
llvm::StringRef Filename
The included filename as written.
clang::FileEntryRef File
The included file.

void dump()

Description

Dump the contents of the module map, for debugging purposes.

Declared at: clang/include/clang/Lex/ModuleMap.h:711

void excludeHeader(clang::Module* Mod,
                   Module::Header Header)

Description

Marks this header as being excluded from the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:683

Parameters

clang::Module* Mod
Module::Header Header

ArrayRef<clang::ModuleMap::KnownHeader>
findAllModulesForHeader(
    const clang::FileEntry* File)

Description

Retrieve all the modules that contain the given header file. Note that this does not implicitly load module maps, except for builtin headers, and does not consult the external source. (Those checks are the responsibility of \ref HeaderSearch.) Typically, \ref findModuleForHeader should be used instead, as it picks the preferred module for the header.

Declared at: clang/include/clang/Lex/ModuleMap.h:446

Parameters

const clang::FileEntry* File

Optional<clang::FileEntryRef> findHeader(
    clang::Module* M,
    const Module::UnresolvedHeaderDirective&
        Header,
    SmallVectorImpl<char>& RelativePathName,
    bool& NeedsFramework)

Description

Look up the given header directive to find an actual header file.

Declared at: clang/include/clang/Lex/ModuleMap.h:332

Parameters

clang::Module* M
The module in which we're resolving the header directive.
const Module::UnresolvedHeaderDirective& Header
The header directive to resolve.
SmallVectorImpl<char>& RelativePathName
Filled in with the relative path name from the module to the resolved header.
bool& NeedsFramework
If M is not a framework but a missing header would be found in case M was, set it to true. False otherwise.

Returns

The resolved file, if any.

clang::ModuleMap::KnownHeader
findHeaderInUmbrellaDirs(
    const clang::FileEntry* File,
    SmallVectorImpl<const clang::DirectoryEntry*>&
        IntermediateDirs)

Description

Searches for a module whose umbrella directory contains \p File.

Declared at: clang/include/clang/Lex/ModuleMap.h:363

Parameters

const clang::FileEntry* File
The header to search for.
SmallVectorImpl<const clang::DirectoryEntry*>& IntermediateDirs
On success, contains the set of directories searched before finding \p File.

HeadersMap::iterator findKnownHeader(
    const clang::FileEntry* File)

Description

Looks up the modules that \p File corresponds to. If \p File represents a builtin header within Clang's builtin include directory, this also loads all of the module maps to see if it will get associated with a specific module (e.g. in /usr/include).

Declared at: clang/include/clang/Lex/ModuleMap.h:355

Parameters

const clang::FileEntry* File

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

Description

Retrieve a module with the given name.

Declared at: clang/include/clang/Lex/ModuleMap.h:498

Parameters

llvm::StringRef Name
The name of the module to look up.

Returns

The named module, if known; otherwise, returns null.

clang::ModuleMap::KnownHeader findModuleForHeader(
    const clang::FileEntry* File,
    bool AllowTextual = false)

Description

Retrieve the module that owns the given header file, if any. Note that this does not implicitly load module maps, except for builtin headers, and does not consult the external source. (Those checks are the responsibility of \ref HeaderSearch.)

Declared at: clang/include/clang/Lex/ModuleMap.h:436

Parameters

const clang::FileEntry* File
The header file that is likely to be included.
bool AllowTextual = false
If \c true and \p File is a textual header, return its owning module. Otherwise, no KnownHeader will be returned if the file is only known as a textual header.

Returns

The module KnownHeader, which provides the module that owns the given header file. The KnownHeader is default constructed to indicate that no module owns this header file.

std::pair<Module*, bool> findOrCreateModule(
    llvm::StringRef Name,
    clang::Module* Parent,
    bool IsFramework,
    bool IsExplicit)

Description

Find a new module or submodule, or create it if it does not already exist.

Declared at: clang/include/clang/Lex/ModuleMap.h:536

Parameters

llvm::StringRef Name
The name of the module to find or create.
clang::Module* Parent
The module that will act as the parent of this submodule, or nullptr to indicate that this is a top-level module.
bool IsFramework
Whether this is a framework module.
bool IsExplicit
Whether this is an explicit submodule.

Returns

The found or newly-created module, along with a boolean value that will be true if the module is newly-created.

clang::ModuleMap::KnownHeader
findOrCreateModuleForHeaderInUmbrellaDir(
    const clang::FileEntry* File)

Description

Given that \p File is not in the Headers map, look it up within umbrella directories and find or create a module for it.

Declared at: clang/include/clang/Lex/ModuleMap.h:368

Parameters

const clang::FileEntry* File

ArrayRef<clang::ModuleMap::KnownHeader>
findResolvedModulesForHeader(
    const clang::FileEntry* File) const

Description

Like \ref findAllModulesForHeader, but do not attempt to infer module ownership from umbrella headers if we've not already done so.

Declared at: clang/include/clang/Lex/ModuleMap.h:451

Parameters

const clang::FileEntry* File

void finishModuleDeclarationScope()

Description

Creates a new declaration scope for module names, allowing previously defined modules to shadow definitions from the new scope.

Declared at: clang/include/clang/Lex/ModuleMap.h:586

clang::ModuleMap::AdditionalModMapsSet*
getAdditionalModuleMapFiles(
    const clang::Module* M)

Description

Get any module map files other than getModuleMapFileForUniquing(M) that define submodules of a top-level module \p M. This is cheaper than getting the module map file for each submodule individually, since the expected number of results is very small.

Declared at: clang/include/clang/Lex/ModuleMap.h:626

Parameters

const clang::Module* M

const clang::DirectoryEntry* getBuiltinDir() const

Description

Get the directory that contains Clang-supplied include files.

Declared at: clang/include/clang/Lex/ModuleMap.h:409

llvm::Optional<Module*> getCachedModuleLoad(
    const clang::IdentifierInfo& II)

Description

Return a cached module load.

Declared at: clang/include/clang/Lex/ModuleMap.h:727

Parameters

const clang::IdentifierInfo& II

const clang::FileEntry*
getContainingModuleMapFile(
    const clang::Module* Module) const

Description

Retrieve the module map file containing the definition of the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:607

Parameters

const clang::Module* Module
The module whose module map file will be returned, if known.

Returns

The file entry for the module map file containing the given module, or nullptr if the module definition was inferred.

const clang::FileEntry*
getModuleMapFileForUniquing(
    const clang::Module* M) const

Description

Get the module map file that (along with the module name) uniquely identifies this module. The particular module that \c Name refers to may depend on how the module was found in header search. However, the combination of \c Name and this module map will be globally unique for top-level modules. In the case of inferred modules, returns the module map that allowed the inference (e.g. contained 'module *'). Otherwise, returns getContainingModuleMapFile().

Declared at: clang/include/clang/Lex/ModuleMap.h:618

Parameters

const clang::Module* M

static clang::ModuleMap::ModuleHeaderRole
headerKindToRole(Module::HeaderKind Kind)

Description

Convert a header kind to a role. Requires Kind to not be HK_Excluded.

Declared at: clang/include/clang/Lex/ModuleMap.h:148

Parameters

Module::HeaderKind Kind

static Module::HeaderKind headerRoleToKind(
    clang::ModuleMap::ModuleHeaderRole Role)

Description

Convert a header role to a kind.

Declared at: clang/include/clang/Lex/ModuleMap.h:151

Parameters

clang::ModuleMap::ModuleHeaderRole Role

clang::Module* inferFrameworkModule(
    const clang::DirectoryEntry* FrameworkDir,
    bool IsSystem,
    clang::Module* Parent)

Description

Infer the contents of a framework module map from the given framework directory.

Declared at: clang/include/clang/Lex/ModuleMap.h:573

Parameters

const clang::DirectoryEntry* FrameworkDir
bool IsSystem
clang::Module* Parent

clang::Module* inferFrameworkModule(
    const clang::DirectoryEntry* FrameworkDir,
    clang::ModuleMap::Attributes Attrs,
    clang::Module* Parent)

Declared at: clang/include/clang/Lex/ModuleMap.h:377

Parameters

const clang::DirectoryEntry* FrameworkDir
clang::ModuleMap::Attributes Attrs
clang::Module* Parent

bool isBuiltinHeader(const clang::FileEntry* File)

Declared at: clang/include/clang/Lex/ModuleMap.h:415

Parameters

const clang::FileEntry* File

static bool isBuiltinHeader(
    llvm::StringRef FileName)

Description

Is this a compiler builtin header?

Declared at: clang/include/clang/Lex/ModuleMap.h:414

Parameters

llvm::StringRef FileName

bool isHeaderInUmbrellaDirs(
    const clang::FileEntry* File)

Description

A convenience method to determine if \p File is (possibly nested) in an umbrella directory.

Declared at: clang/include/clang/Lex/ModuleMap.h:372

Parameters

const clang::FileEntry* File

bool isHeaderInUnavailableModule(
    const clang::FileEntry* Header) const

Description

Determine whether the given header is part of a module marked 'unavailable'.

Declared at: clang/include/clang/Lex/ModuleMap.h:486

Parameters

const clang::FileEntry* Header

bool isHeaderUnavailableInModule(
    const clang::FileEntry* Header,
    const clang::Module* RequestingModule) const

Description

Determine whether the given header is unavailable as part of the specified module.

Declared at: clang/include/clang/Lex/ModuleMap.h:490

Parameters

const clang::FileEntry* Header
const clang::Module* RequestingModule

clang::Module* lookupModuleQualified(
    llvm::StringRef Name,
    clang::Module* Context) const

Description

Retrieve a module with the given name within the given context, using direct (qualified) name lookup.

Declared at: clang/include/clang/Lex/ModuleMap.h:520

Parameters

llvm::StringRef Name
The name of the module to look up.
clang::Module* Context
The module for which we will look for a submodule. If null, we will look for a top-level module.

Returns

The named submodule, if known; otherwose, returns null.

clang::Module* lookupModuleUnqualified(
    llvm::StringRef Name,
    clang::Module* Context) const

Description

Retrieve a module with the given name using lexical name lookup, starting at the given context.

Declared at: clang/include/clang/Lex/ModuleMap.h:509

Parameters

llvm::StringRef Name
The name of the module to look up.
clang::Module* Context
The module context, from which we will perform lexical name lookup.

Returns

The named module, if known; otherwise, returns null.

bool mayShadowNewModule(
    clang::Module* ExistingModule)

Declared at: clang/include/clang/Lex/ModuleMap.h:588

Parameters

clang::Module* ExistingModule

clang::ModuleMap::module_iterator module_begin()
    const

Declared at: clang/include/clang/Lex/ModuleMap.h:715

clang::ModuleMap::module_iterator module_end()
    const

Declared at: clang/include/clang/Lex/ModuleMap.h:716

llvm::iterator_range<module_iterator> modules()
    const

Declared at: clang/include/clang/Lex/ModuleMap.h:717

bool parseModuleMapFile(
    const clang::FileEntry* File,
    bool IsSystem,
    const clang::DirectoryEntry* HomeDir,
    clang::FileID ID = clang::FileID(),
    unsigned int* Offset = nullptr,
    clang::SourceLocation ExternModuleLoc =
        clang::SourceLocation())

Description

Parse the given module map file, and record any modules we encounter.

Declared at: clang/include/clang/Lex/ModuleMap.h:705

Parameters

const clang::FileEntry* File
The file to be parsed.
bool IsSystem
Whether this module map file is in a system header directory, and therefore should be considered a system module.
const clang::DirectoryEntry* HomeDir
The directory in which relative paths within this module map file will be resolved.
clang::FileID ID = clang::FileID()
The FileID of the file to process, if we've already entered it.
unsigned int* Offset = nullptr
[inout] On input the offset at which to start parsing. On output, the offset at which the module map terminated.
clang::SourceLocation ExternModuleLoc = clang::SourceLocation()
The location of the "extern module" declaration that caused us to load this module map file, if any.

Returns

true if an error occurred, false otherwise.

bool resolveAsBuiltinHeader(
    clang::Module* M,
    const Module::UnresolvedHeaderDirective&
        Header)

Description

Attempt to resolve the specified header directive as naming a builtin header.

Declared at: clang/include/clang/Lex/ModuleMap.h:347

Parameters

clang::Module* M
const Module::UnresolvedHeaderDirective& Header

Returns

\c true if a corresponding builtin header was found.

bool resolveConflicts(clang::Module* Mod,
                      bool Complain)

Description

Resolve all of the unresolved conflicts in the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:663

Parameters

clang::Module* Mod
The module whose conflicts should be resolved.
bool Complain
Whether to emit diagnostics for failures.

Returns

true if any errors were encountered while resolving conflicts, false otherwise.

Module::ExportDecl resolveExport(
    clang::Module* Mod,
    const Module::UnresolvedExportDecl&
        Unresolved,
    bool Complain) const

Description

Resolve the given export declaration into an actual export declaration.

Declared at: clang/include/clang/Lex/ModuleMap.h:295

Parameters

clang::Module* Mod
The module in which we're resolving the export declaration.
const Module::UnresolvedExportDecl& Unresolved
The export declaration to resolve.
bool Complain
Whether this routine should complain about unresolvable exports.

Returns

The resolved export declaration, which will have a NULL pointer if the export could not be resolved.

bool resolveExports(clang::Module* Mod,
                    bool Complain)

Description

Resolve all of the unresolved exports in the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:643

Parameters

clang::Module* Mod
The module whose exports should be resolved.
bool Complain
Whether to emit diagnostics for failures.

Returns

true if any errors were encountered while resolving exports, false otherwise.

void resolveHeader(
    clang::Module* M,
    const Module::UnresolvedHeaderDirective&
        Header,
    bool& NeedsFramework)

Description

Resolve the given header directive.

Declared at: clang/include/clang/Lex/ModuleMap.h:341

Parameters

clang::Module* M
The module in which we're resolving the header directive.
const Module::UnresolvedHeaderDirective& Header
The header directive to resolve.
bool& NeedsFramework
If M is not a framework but a missing header would be found in case M was, set it to true. False otherwise.

void resolveHeaderDirectives(
    const clang::FileEntry* File) const

Description

Resolve all lazy header directives for the specified file. This ensures that the HeaderFileInfo on HeaderSearch is up to date. This is effectively internal, but is exposed so HeaderSearch can call it.

Declared at: clang/include/clang/Lex/ModuleMap.h:457

Parameters

const clang::FileEntry* File

void resolveHeaderDirectives(
    clang::Module* Mod,
    llvm::Optional<const FileEntry*> File) const

Description

Resolve lazy header directives for the specified module. If File is provided, only headers with same size and modtime are resolved. If File is not set, all headers are resolved.

Declared at: clang/include/clang/Lex/ModuleMap.h:462

Parameters

clang::Module* Mod
llvm::Optional<const FileEntry*> File

void resolveLinkAsDependencies(clang::Module* Mod)

Description

Use PendingLinkAsModule information to mark top level link names that are going to be replaced by export_as aliases.

Declared at: clang/include/clang/Lex/ModuleMap.h:121

Parameters

clang::Module* Mod

clang::Module* resolveModuleId(
    const clang::ModuleId& Id,
    clang::Module* Mod,
    bool Complain) const

Description

Resolve the given module id to an actual module.

Declared at: clang/include/clang/Lex/ModuleMap.h:309

Parameters

const clang::ModuleId& Id
The module-id to resolve.
clang::Module* Mod
The module in which we're resolving the module-id.
bool Complain
Whether this routine should complain about unresolvable module-ids.

Returns

The resolved module, or null if the module-id could not be resolved.

bool resolveUses(clang::Module* Mod,
                 bool Complain)

Description

Resolve all of the unresolved uses in the given module.

Declared at: clang/include/clang/Lex/ModuleMap.h:653

Parameters

clang::Module* Mod
The module whose uses should be resolved.
bool Complain
Whether to emit diagnostics for failures.

Returns

true if any errors were encountered while resolving uses, false otherwise.

void setBuiltinIncludeDir(
    const clang::DirectoryEntry* Dir)

Description

Set the directory that contains Clang-supplied include files, such as our stdarg.h or tgmath.h.

Declared at: clang/include/clang/Lex/ModuleMap.h:404

Parameters

const clang::DirectoryEntry* Dir

void setInferredModuleAllowedBy(
    clang::Module* M,
    const clang::FileEntry* ModMap)

Declared at: clang/include/clang/Lex/ModuleMap.h:620

Parameters

clang::Module* M
const clang::FileEntry* ModMap

void setTarget(const clang::TargetInfo& Target)

Description

Set the target information.

Declared at: clang/include/clang/Lex/ModuleMap.h:400

Parameters

const clang::TargetInfo& Target

void setUmbrellaDir(
    clang::Module* Mod,
    const clang::DirectoryEntry* UmbrellaDir,
    const llvm::Twine& NameAsWritten,
    const llvm::Twine&
        PathRelativeToRootModuleDirectory)

Description

Sets the umbrella directory of the given module to the given directory.

Declared at: clang/include/clang/Lex/ModuleMap.h:673

Parameters

clang::Module* Mod
const clang::DirectoryEntry* UmbrellaDir
const llvm::Twine& NameAsWritten
const llvm::Twine& PathRelativeToRootModuleDirectory

void setUmbrellaHeader(
    clang::Module* Mod,
    const clang::FileEntry* UmbrellaHeader,
    const llvm::Twine& NameAsWritten,
    const llvm::Twine&
        PathRelativeToRootModuleDirectory)

Description

Sets the umbrella header of the given module to the given header.

Declared at: clang/include/clang/Lex/ModuleMap.h:667

Parameters

clang::Module* Mod
const clang::FileEntry* UmbrellaHeader
const llvm::Twine& NameAsWritten
const llvm::Twine& PathRelativeToRootModuleDirectory

~ModuleMap()

Description

Destroy the module map.

Declared at: clang/include/clang/Lex/ModuleMap.h:397