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