diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 2 |
4 files changed, 7 insertions, 14 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7de6c14ef36..e1a67f9e9d1 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1680,12 +1680,11 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, ReplaceRange, ("@import " + PathString + ";").str()); } - // Load the module. Only make macros visible. We'll make the declarations + // Load the module to import its macros. We'll make the declarations // visible when the parser gets here. - Module::NameVisibilityKind Visibility = Module::MacrosVisible; - ModuleLoadResult Imported - = TheModuleLoader.loadModule(IncludeTok.getLocation(), Path, Visibility, - /*IsIncludeDirective=*/true); + ModuleLoadResult Imported = TheModuleLoader.loadModule( + IncludeTok.getLocation(), Path, Module::Hidden, + /*IsIncludeDirective=*/true); if (Imported) makeModuleVisible(Imported, IncludeTok.getLocation()); assert((Imported == nullptr || Imported == SuggestedModule.getModule()) && diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 1251e982533..21dccd127bf 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -752,7 +752,7 @@ void Preprocessor::LexAfterModuleImport(Token &Result) { if (getLangOpts().Modules) { Imported = TheModuleLoader.loadModule(ModuleImportLoc, ModuleImportPath, - Module::MacrosVisible, + Module::Hidden, /*IsIncludeDirective=*/false); if (Imported) makeModuleVisible(Imported, ModuleImportLoc); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 150306176eb..e6f35e16c4b 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3222,10 +3222,7 @@ static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) { } void ASTReader::makeNamesVisible(const HiddenNames &Names, Module *Owner) { - assert(Owner->NameVisibility >= Module::MacrosVisible && - "nothing to make visible?"); - - // FIXME: Only do this if Owner->NameVisibility == AllVisible. + assert(Owner->NameVisibility != Module::Hidden && "nothing to make visible?"); for (Decl *D : Names) { bool wasHidden = D->Hidden; D->Hidden = false; @@ -3259,9 +3256,6 @@ void ASTReader::makeModuleVisible(Module *Mod, } // Update the module's name visibility. - if (NameVisibility >= Module::MacrosVisible && - Mod->NameVisibility < Module::MacrosVisible) - Mod->MacroVisibilityLoc = ImportLoc; Mod->NameVisibility = NameVisibility; // If we've already deserialized any names from this module, diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 7ea50e5003f..377820db131 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4458,7 +4458,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, // FIXME: If the module has macros imported then later has declarations // imported, this location won't be the right one as a location for the // declaration imports. - AddSourceLocation(Import.M->MacroVisibilityLoc, ImportedModules); + AddSourceLocation(PP.getModuleImportLoc(Import.M), ImportedModules); } Stream.EmitRecord(IMPORTED_MODULES, ImportedModules); |