diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-01 01:53:09 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-01 01:53:09 +0000 |
commit | a7e2cc684fee41abe367205521bf225dd3d582c0 (patch) | |
tree | 181a89be83c538a615bd2a1cf9200826c848960a /clang/lib/Serialization | |
parent | 65ace9daa36051aeeb8140bce8e154c61374938f (diff) | |
download | bcm5719-llvm-a7e2cc684fee41abe367205521bf225dd3d582c0.tar.gz bcm5719-llvm-a7e2cc684fee41abe367205521bf225dd3d582c0.zip |
[modules] Start moving the module visibility information off the Module itself.
It has no place there; it's not a property of the Module, and it makes
restoring the visibility set when we leave a submodule more difficult.
llvm-svn: 236300
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 29 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 13 |
2 files changed, 7 insertions, 35 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 7225d2f610a..d67d79b52df 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3240,8 +3240,7 @@ void ASTReader::makeNamesVisible(const HiddenNames &Names, Module *Owner) { void ASTReader::makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, - SourceLocation ImportLoc, - bool Complain) { + SourceLocation ImportLoc) { llvm::SmallPtrSet<Module *, 4> Visited; SmallVector<Module *, 4> Stack; Stack.push_back(Mod); @@ -3285,20 +3284,6 @@ void ASTReader::makeModuleVisible(Module *Mod, if (Visited.insert(Exported).second) Stack.push_back(Exported); } - - // Detect any conflicts. - if (Complain) { - assert(ImportLoc.isValid() && "Missing import location"); - for (unsigned I = 0, N = Mod->Conflicts.size(); I != N; ++I) { - if (Mod->Conflicts[I].Other->NameVisibility >= NameVisibility) { - Diag(ImportLoc, diag::warn_module_conflict) - << Mod->getFullModuleName() - << Mod->Conflicts[I].Other->getFullModuleName() - << Mod->Conflicts[I].Message; - // FIXME: Need note where the other module was imported. - } - } - } } } @@ -3669,7 +3654,7 @@ ASTReader::ReadASTCore(StringRef FileName, return Success; } -void ASTReader::InitializeContext() { +void ASTReader::InitializeContext() { // If there's a listener, notify them that we "read" the translation unit. if (DeserializationListener) DeserializationListener->DeclRead(PREDEF_DECL_TRANSLATION_UNIT_ID, @@ -3792,13 +3777,13 @@ void ASTReader::InitializeContext() { } // Re-export any modules that were imported by a non-module AST file. - // FIXME: This does not make macro-only imports visible again. It also doesn't - // make #includes mapped to module imports visible. + // FIXME: This does not make macro-only imports visible again. for (auto &Import : ImportedModules) { - if (Module *Imported = getSubmodule(Import.ID)) + if (Module *Imported = getSubmodule(Import.ID)) { makeModuleVisible(Imported, Module::AllVisible, - /*ImportLoc=*/Import.ImportLoc, - /*Complain=*/false); + /*ImportLoc=*/Import.ImportLoc); + PP.makeModuleVisible(Imported, Import.ImportLoc); + } } ImportedModules.clear(); } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 38436977341..8a3b9d5163f 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -2323,19 +2323,6 @@ static unsigned getNumberOfModules(Module *Mod) { } void ASTWriter::WriteSubmodules(Module *WritingModule) { - // Determine the dependencies of our module and each of it's submodules. - // FIXME: This feels like it belongs somewhere else, but there are no - // other consumers of this information. - SourceManager &SrcMgr = PP->getSourceManager(); - ModuleMap &ModMap = PP->getHeaderSearchInfo().getModuleMap(); - for (const auto *I : Context->local_imports()) { - if (Module *ImportedFrom - = ModMap.inferModuleFromLocation(FullSourceLoc(I->getLocation(), - SrcMgr))) { - ImportedFrom->Imports.push_back(I->getImportedModule()); - } - } - // Enter the submodule description block. Stream.EnterSubblock(SUBMODULE_BLOCK_ID, /*bits for abbreviations*/5); |