clang API Documentation

Public Types | Public Member Functions | Friends
clang::ModuleMap Class Reference

#include <ModuleMap.h>

List of all members.

Public Types

typedef llvm::StringMap
< Module * >::const_iterator 
module_iterator

Public Member Functions

 ModuleMap (FileManager &FileMgr, const DiagnosticConsumer &DC, const LangOptions &LangOpts, const TargetInfo *Target)
 Construct a new module map.
 ~ModuleMap ()
 Destroy the module map.
void setTarget (const TargetInfo &Target)
 Set the target information.
void setBuiltinIncludeDir (const DirectoryEntry *Dir)
 Set the directory that contains Clang-supplied include files, such as our stdarg.h or tgmath.h.
ModulefindModuleForHeader (const FileEntry *File)
 Retrieve the module that owns the given header file, if any.
bool isHeaderInUnavailableModule (const FileEntry *Header)
 Determine whether the given header is part of a module marked 'unavailable'.
ModulefindModule (StringRef Name)
 Retrieve a module with the given name.
ModulelookupModuleUnqualified (StringRef Name, Module *Context)
 Retrieve a module with the given name using lexical name lookup, starting at the given context.
ModulelookupModuleQualified (StringRef Name, Module *Context)
 Retrieve a module with the given name within the given context, using direct (qualified) name lookup.
std::pair< Module *, bool > findOrCreateModule (StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
 Find a new module or submodule, or create it if it does not already exist.
ModuleinferFrameworkModule (StringRef ModuleName, const DirectoryEntry *FrameworkDir, bool IsSystem, Module *Parent)
 Infer the contents of a framework module map from the given framework directory.
const FileEntrygetContainingModuleMapFile (Module *Module)
 Retrieve the module map file containing the definition of the given module.
bool resolveExports (Module *Mod, bool Complain)
 Resolve all of the unresolved exports in the given module.
ModuleinferModuleFromLocation (FullSourceLoc Loc)
 Infers the (sub)module based on the given source location and source manager.
void setUmbrellaHeader (Module *Mod, const FileEntry *UmbrellaHeader)
 Sets the umbrella header of the given module to the given header.
void setUmbrellaDir (Module *Mod, const DirectoryEntry *UmbrellaDir)
 Sets the umbrella directory of the given module to the given directory.
void addHeader (Module *Mod, const FileEntry *Header)
 Adds this header to the given module.
bool parseModuleMapFile (const FileEntry *File)
 Parse the given module map file, and record any modules we encounter.
void dump ()
 Dump the contents of the module map, for debugging purposes.
module_iterator module_begin () const
module_iterator module_end () const

Friends

class ModuleMapParser

Detailed Description

Definition at line 38 of file ModuleMap.h.


Member Typedef Documentation

typedef llvm::StringMap<Module *>::const_iterator clang::ModuleMap::module_iterator

Definition at line 231 of file ModuleMap.h.


Constructor & Destructor Documentation

ModuleMap::ModuleMap ( FileManager FileMgr,
const DiagnosticConsumer DC,
const LangOptions LangOpts,
const TargetInfo Target 
)

Construct a new module map.

Parameters:
FileMgrThe file manager used to find module files and headers. This file manager should be shared with the header-search mechanism, since they will refer to the same headers.
DCA diagnostic consumer that will be cloned for use in generating diagnostics.
LangOptsLanguage options for this translation unit.
TargetThe target for this translation unit.

Definition at line 72 of file ModuleMap.cpp.

References clang::DiagnosticConsumer::clone().

ModuleMap::~ModuleMap ( )

Destroy the module map.

Definition at line 83 of file ModuleMap.cpp.


Member Function Documentation

void ModuleMap::addHeader ( Module Mod,
const FileEntry Header 
)

Adds this header to the given module.

Definition at line 369 of file ModuleMap.cpp.

References clang::Module::Headers.

void ModuleMap::dump ( )

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

Definition at line 383 of file ModuleMap.cpp.

Module * ModuleMap::findModule ( StringRef  Name)

Retrieve a module with the given name.

Parameters:
Thename of the module to look up.
Returns:
The named module, if known; otherwise, returns null.

Definition at line 251 of file ModuleMap.cpp.

Referenced by clang::HeaderSearch::lookupModule(), lookupModuleQualified(), and lookupModuleUnqualified().

Module * ModuleMap::findModuleForHeader ( const FileEntry File)

Retrieve the module that owns the given header file, if any.

Parameters:
FileThe header file that is likely to be included.
Returns:
The module that owns the given header file, or null to indicate that no module owns this header file.

Definition at line 99 of file ModuleMap.cpp.

References clang::Module::Exports, findOrCreateModule(), clang::FileEntry::getDir(), clang::FileManager::getDirectory(), clang::SourceManager::getFileManager(), clang::DirectoryEntry::getName(), clang::FileEntry::getName(), clang::Module::getUmbrellaDir(), clang::Module::InferExplicitSubmodules, clang::Module::InferExportWildcard, clang::Module::InferSubmodules, clang::Module::isAvailable(), and clang::Module::Parent.

Referenced by clang::HeaderSearch::findModuleForHeader(), and inferModuleFromLocation().

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

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

Parameters:
NameThe name of the module to find or create.
ParentThe module that will act as the parent of this submodule, or NULL to indicate that this is a top-level module.
IsFrameworkWhether this is a framework module.
IsExplicitWhether 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.

Definition at line 276 of file ModuleMap.cpp.

References lookupModuleQualified().

Referenced by findModuleForHeader().

const FileEntry * ModuleMap::getContainingModuleMapFile ( Module Module)

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

Parameters:
ModuleThe module whose module map file will be returned, if known.
Returns:
The file entry for the module map file containing the given module, or NULL if the module definition was inferred.

Definition at line 375 of file ModuleMap.cpp.

References clang::Module::DefinitionLoc, clang::SourceManager::getFileEntryForID(), clang::SourceManager::getFileID(), and clang::SourceLocation::isInvalid().

Referenced by compileModule().

Module * ModuleMap::inferFrameworkModule ( StringRef  ModuleName,
const DirectoryEntry FrameworkDir,
bool  IsSystem,
Module Parent 
)
Module * ModuleMap::inferModuleFromLocation ( FullSourceLoc  Loc)

Infers the (sub)module based on the given source location and source manager.

Parameters:
LocThe location within the source that we are querying, along with its source manager.
Returns:
The module that owns this source location, or null if no module owns this source location.

Definition at line 414 of file ModuleMap.cpp.

References findModuleForHeader(), clang::FullSourceLoc::getExpansionLoc(), clang::SourceManager::getFileEntryForID(), clang::FullSourceLoc::getFileID(), clang::SourceManager::getFileID(), clang::SourceManager::getIncludeLoc(), clang::FullSourceLoc::getManager(), clang::SourceLocation::isFileID(), and clang::SourceLocation::isInvalid().

Referenced by clang::ASTWriter::inferSubmoduleIDFromLocation().

bool ModuleMap::isHeaderInUnavailableModule ( const FileEntry Header)
Module * ModuleMap::lookupModuleQualified ( StringRef  Name,
Module Context 
)

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

Parameters:
Thename of the module to look up.
ContextThe 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.

Definition at line 268 of file ModuleMap.cpp.

References findModule(), and clang::Module::findSubmodule().

Referenced by findOrCreateModule(), inferFrameworkModule(), isHeaderInUnavailableModule(), and lookupModuleUnqualified().

Module * ModuleMap::lookupModuleUnqualified ( StringRef  Name,
Module Context 
)

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

Parameters:
Thename of the module to look up.
ContextThe module context, from which we will perform lexical name lookup.
Returns:
The named module, if known; otherwise, returns null.

Definition at line 259 of file ModuleMap.cpp.

References findModule(), lookupModuleQualified(), and clang::Module::Parent.

module_iterator clang::ModuleMap::module_begin ( ) const [inline]

Definition at line 232 of file ModuleMap.h.

Referenced by clang::HeaderSearch::collectAllModules().

module_iterator clang::ModuleMap::module_end ( ) const [inline]

Definition at line 233 of file ModuleMap.h.

Referenced by clang::HeaderSearch::collectAllModules().

bool ModuleMap::parseModuleMapFile ( const FileEntry File)

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

Parameters:
FileThe file to be parsed.
Returns:
true if an error occurred, false otherwise.

Definition at line 1421 of file ModuleMap.cpp.

References clang::SrcMgr::C_User, clang::SourceManager::createFileID(), clang::SourceManager::getBuffer(), and clang::FileEntry::getDir().

Referenced by clang::HeaderSearch::loadModuleMapFile().

bool ModuleMap::resolveExports ( Module Mod,
bool  Complain 
)

Resolve all of the unresolved exports in the given module.

Parameters:
ModThe module whose exports should be resolved.
ComplainWhether to emit diagnostics for failures.
Returns:
true if any errors were encountered while resolving exports, false otherwise.

Definition at line 400 of file ModuleMap.cpp.

References clang::Module::Exports, and clang::Module::UnresolvedExports.

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

void clang::ModuleMap::setBuiltinIncludeDir ( const DirectoryEntry Dir) [inline]

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

Definition at line 111 of file ModuleMap.h.

Referenced by clang::ApplyHeaderSearchOptions().

void ModuleMap::setTarget ( const TargetInfo Target)

Set the target information.

Definition at line 93 of file ModuleMap.cpp.

Referenced by clang::HeaderSearch::setTarget().

void ModuleMap::setUmbrellaDir ( Module Mod,
const DirectoryEntry UmbrellaDir 
)

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

Definition at line 364 of file ModuleMap.cpp.

References clang::Module::Umbrella.

void ModuleMap::setUmbrellaHeader ( Module Mod,
const FileEntry UmbrellaHeader 
)

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

Definition at line 358 of file ModuleMap.cpp.

References clang::FileEntry::getDir(), and clang::Module::Umbrella.


Friends And Related Function Documentation

friend class ModuleMapParser [friend]

Definition at line 68 of file ModuleMap.h.


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