diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 08957ce..1d27f74 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1216,9 +1216,7 @@ void Sema::ActOnEndOfTranslationUnit() { // module declaration by now. if (getLangOpts().getCompilingModule() == LangOptions::CMK_ModuleInterface && - (ModuleScopes.empty() || - !ModuleScopes.back().Module->isModulePurview()) && - !DiagnosedMissingModuleDeclaration) { + !isCurrentModulePurview() && !DiagnosedMissingModuleDeclaration) { // FIXME: Make a better guess as to where to put the module declaration. Diag(getSourceManager().getLocForStartOfFile( getSourceManager().getMainFileID()), diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index f5c24bd..757c611 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -207,8 +207,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, // here, in order to support macro import. // Only one module-declaration is permitted per source file. - if (!ModuleScopes.empty() && - ModuleScopes.back().Module->isModulePurview()) { + if (isCurrentModulePurview()) { Diag(ModuleLoc, diag::err_module_redeclaration); Diag(VisibleModules.getImportLoc(ModuleScopes.back().Module), diag::note_prev_module_declaration); @@ -717,7 +716,7 @@ Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, // An export-declaration shall appear only [...] in the purview of a module // interface unit. An export-declaration shall not appear directly or // indirectly within [...] a private-module-fragment. - if (ModuleScopes.empty() || !ModuleScopes.back().Module->isModulePurview()) { + if (!isCurrentModulePurview()) { Diag(ExportLoc, diag::err_export_not_in_module_interface) << 0; D->setInvalidDecl(); return D; |