Lines Matching full:module
1 //===- Module.cpp - Describe a module -------------------------------------===//
9 // This file defines the Module class, which describes a module in the source
14 #include "clang/Basic/Module.h"
37 Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, in Module() function in Module
61 Module::~Module() { in ~Module()
131 bool Module::isUnimportable(const LangOptions &LangOpts, in isUnimportable()
133 Module *&ShadowingModule) const { in isUnimportable()
137 for (const Module *Current = this; Current; Current = Current->Parent) { in isUnimportable()
151 llvm_unreachable("could not find a reason why module is unimportable"); in isUnimportable()
155 // the specified module, meaning Clang won't build the specified module. This
157 // that vends a module map, one might want to avoid hitting intermediate build
158 // products containing the module map or avoid finding the system installed
160 bool Module::isForBuilding(const LangOptions &LangOpts) const { in isForBuilding()
176 bool Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target, in isAvailable()
179 Module *&ShadowingModule) const { in isAvailable()
186 // FIXME: All missing headers are listed on the top-level module. Should we in isAvailable()
188 for (const Module *Current = this; Current; Current = Current->Parent) { in isAvailable()
195 llvm_unreachable("could not find a reason why module is unavailable"); in isAvailable()
198 bool Module::isSubModuleOf(const Module *Other) const { in isSubModuleOf()
206 const Module *Module::getTopLevelModule() const { in getTopLevelModule()
207 const Module *Result = this; in getTopLevelModule()
244 std::string Module::getFullModuleName(bool AllowStringLiterals) const { in getFullModuleName()
247 // Build up the set of module names (from innermost to outermost). in getFullModuleName()
248 for (const Module *M = this; M; M = M->Parent) in getFullModuleName()
260 bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const { in fullModuleNameIs()
261 for (const Module *M = this; M; M = M->Parent) { in fullModuleNameIs()
269 OptionalDirectoryEntryRef Module::getEffectiveUmbrellaDir() const { in getEffectiveUmbrellaDir()
277 void Module::addTopHeader(FileEntryRef File) { in addTopHeader()
282 ArrayRef<FileEntryRef> Module::getTopHeaders(FileManager &FileMgr) { in getTopHeaders()
293 bool Module::directlyUses(const Module *Requested) { in directlyUses()
296 // A top-level module implicitly uses itself. in directlyUses()
309 // module. in directlyUses()
319 void Module::addRequirement(StringRef Feature, bool RequiredState, in addRequirement()
331 void Module::markUnavailable(bool Unimportable) { in markUnavailable()
332 auto needUpdate = [Unimportable](Module *M) { in markUnavailable()
339 SmallVector<Module *, 2> Stack; in markUnavailable()
342 Module *Current = Stack.back(); in markUnavailable()
357 Module *Module::findSubmodule(StringRef Name) const { in findSubmodule()
365 Module *Module::findOrInferSubmodule(StringRef Name) { in findOrInferSubmodule()
371 Module *Result = new Module(Name, SourceLocation(), this, false, InferExplicitSubmodules, 0); in findOrInferSubmodule()
376 Result->Exports.push_back(Module::ExportDecl(nullptr, true)); in findOrInferSubmodule()
380 Module *Module::getGlobalModuleFragment() const { in getGlobalModuleFragment()
381 assert(isNamedModuleUnit() && "We should only query the global module " in getGlobalModuleFragment()
391 Module *Module::getPrivateModuleFragment() const { in getPrivateModuleFragment()
392 assert(isNamedModuleUnit() && "We should only query the private module " in getPrivateModuleFragment()
402 void Module::getExportedModules(SmallVectorImpl<Module *> &Exported) const { in getExportedModules()
404 for (std::vector<Module *>::const_iterator I = SubModules.begin(), in getExportedModules()
407 Module *Mod = *I; in getExportedModules()
415 SmallVector<Module *, 4> WildcardRestrictions; in getExportedModules()
417 Module *Mod = Exports[I].getPointer(); in getExportedModules()
419 // Export a named module directly; no wildcards involved. in getExportedModules()
431 if (Module *Restriction = Exports[I].getPointer()) in getExportedModules()
445 Module *Mod = Imports[I]; in getExportedModules()
448 // Check whether this module meets one of the restrictions. in getExportedModules()
450 Module *Restriction = WildcardRestrictions[R]; in getExportedModules()
465 void Module::buildVisibleModulesCache() const { in buildVisibleModulesCache()
468 // This module is visible to itself. in buildVisibleModulesCache()
471 // Every imported module is visible. in buildVisibleModulesCache()
472 SmallVector<Module *, 16> Stack(Imports.begin(), Imports.end()); in buildVisibleModulesCache()
474 Module *CurrModule = Stack.pop_back_val(); in buildVisibleModulesCache()
476 // Every module transitively exported by an imported module is visible. in buildVisibleModulesCache()
482 void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const { in print()
488 OS << "module "; in print()
584 // the module. Regular inferred submodules are OK, as we need to look at all in print()
592 if (Module *Restriction = Exports[I].getPointer()) { in print()
612 for (Module *M : Imports) { in print()
664 OS << "module * {\n"; in print()
677 LLVM_DUMP_METHOD void Module::dump() const { in dump()
681 void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc, in setVisible()
683 // We can't import a global module fragment so the location can be invalid. in setVisible()
692 Module *M; in setVisible()
697 // Nothing to do for a module that's already visible. in setVisible()
708 SmallVector<Module *, 16> Exports; in setVisible()
710 for (Module *E : Exports) { in setVisible()
718 llvm::SmallVector<Module*, 8> Path; in setVisible()