clang API Documentation
#include <ModuleMap.h>
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. | |
| Module * | findModuleForHeader (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'. | |
| Module * | findModule (StringRef Name) |
| Retrieve a module with the given name. | |
| Module * | lookupModuleUnqualified (StringRef Name, Module *Context) |
| Retrieve a module with the given name using lexical name lookup, starting at the given context. | |
| Module * | lookupModuleQualified (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. | |
| Module * | inferFrameworkModule (StringRef ModuleName, const DirectoryEntry *FrameworkDir, bool IsSystem, Module *Parent) |
| Infer the contents of a framework module map from the given framework directory. | |
| const FileEntry * | getContainingModuleMapFile (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. | |
| Module * | inferModuleFromLocation (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 |
Definition at line 38 of file ModuleMap.h.
| typedef llvm::StringMap<Module *>::const_iterator clang::ModuleMap::module_iterator |
Definition at line 231 of file ModuleMap.h.
| ModuleMap::ModuleMap | ( | FileManager & | FileMgr, |
| const DiagnosticConsumer & | DC, | ||
| const LangOptions & | LangOpts, | ||
| const TargetInfo * | Target | ||
| ) |
Construct a new module map.
| FileMgr | The 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. |
| DC | A diagnostic consumer that will be cloned for use in generating diagnostics. |
| LangOpts | Language options for this translation unit. |
| Target | The 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.
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.
| The | name of the module to look up. |
Definition at line 251 of file ModuleMap.cpp.
Referenced by clang::HeaderSearch::lookupModule(), lookupModuleQualified(), and lookupModuleUnqualified().
Retrieve the module that owns the given header file, if any.
| File | The header file that is likely to be included. |
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.
| Name | The name of the module to find or create. |
| Parent | The module that will act as the parent of this submodule, or NULL to indicate that this is a top-level module. |
| IsFramework | Whether this is a framework module. |
| IsExplicit | Whether this is an explicit submodule. |
Definition at line 276 of file ModuleMap.cpp.
References lookupModuleQualified().
Referenced by findModuleForHeader().
Retrieve the module map file containing the definition of the given module.
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 | ||
| ) |
Infer the contents of a framework module map from the given framework directory.
Definition at line 291 of file ModuleMap.cpp.
References clang::Module::Exports, clang::FileEntry::getDir(), clang::FileManager::getDirectory(), clang::FileManager::getFile(), clang::SourceManager::getFileManager(), clang::DirectoryEntry::getName(), clang::Module::InferExportWildcard, clang::Module::InferSubmodules, clang::Module::IsSystem, lookupModuleQualified(), and clang::Module::Umbrella.
| Module * ModuleMap::inferModuleFromLocation | ( | FullSourceLoc | Loc | ) |
Infers the (sub)module based on the given source location and source manager.
| Loc | The location within the source that we are querying, along with its source manager. |
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 | ) |
Determine whether the given header is part of a module marked 'unavailable'.
Definition at line 190 of file ModuleMap.cpp.
References clang::FileEntry::getDir(), clang::FileManager::getDirectory(), clang::SourceManager::getFileManager(), clang::DirectoryEntry::getName(), clang::FileEntry::getName(), clang::Module::getUmbrellaDir(), clang::Module::InferSubmodules, clang::Module::isAvailable(), lookupModuleQualified(), and clang::Module::Parent.
Referenced by collectModuleHeaderIncludes(), and clang::Preprocessor::HandleEndOfFile().
Retrieve a module with the given name within the given context, using direct (qualified) name lookup.
| The | name of the module to look up. |
| Context | The module for which we will look for a submodule. If null, we will look for a top-level module. |
Definition at line 268 of file ModuleMap.cpp.
References findModule(), and clang::Module::findSubmodule().
Referenced by findOrCreateModule(), inferFrameworkModule(), isHeaderInUnavailableModule(), and lookupModuleUnqualified().
Retrieve a module with the given name using lexical name lookup, starting at the given context.
| The | name of the module to look up. |
| Context | The module context, from which we will perform lexical name lookup. |
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.
| File | The file to be parsed. |
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.
| Mod | The module whose exports should be resolved. |
| Complain | Whether to emit diagnostics for failures. |
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.
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.
friend class ModuleMapParser [friend] |
Definition at line 68 of file ModuleMap.h.