diff options
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 19d8692..633b822 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1272,6 +1272,18 @@ void Sema::ActOnEndOfTranslationUnit() { Module::ExplicitGlobalModuleFragment) { Diag(ModuleScopes.back().BeginLoc, diag::err_module_declaration_missing_after_global_module_introducer); + } else if (getLangOpts().getCompilingModule() == + LangOptions::CMK_ModuleInterface && + // We can't use ModuleScopes here since ModuleScopes is always + // empty if we're compiling the BMI. + !getASTContext().getCurrentNamedModule()) { + // If we are building a module interface unit, we should have seen the + // module declaration. + // + // FIXME: Make a better guess as to where to put the module declaration. + Diag(getSourceManager().getLocForStartOfFile( + getSourceManager().getMainFileID()), + diag::err_module_declaration_missing); } // Now we can decide whether the modules we're building need an initializer. |