summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-10-11 00:36:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-10-11 00:36:56 +0000
commit18057cb34c83a11889e0cced9ab43aa57875634f (patch)
tree89de9c79b7e00e27f9921337cabedcc2be50abcb /clang/lib/Sema/Sema.cpp
parent922973a46644b6bd1f86780f3cd36d79c5ef2003 (diff)
downloadbcm5719-llvm-18057cb34c83a11889e0cced9ab43aa57875634f.tar.gz
bcm5719-llvm-18057cb34c83a11889e0cced9ab43aa57875634f.zip
[Modules TS] Diagnose missing/duplicate module-declaration.
llvm-svn: 315397
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 62692519674..548f336c3b4 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -930,6 +930,17 @@ void Sema::ActOnEndOfTranslationUnit() {
}
if (TUKind == TU_Module) {
+ // If we are building a module interface unit, we need to have seen the
+ // module declaration by now.
+ if (getLangOpts().getCompilingModule() ==
+ LangOptions::CMK_ModuleInterface &&
+ ModuleScopes.back().Module->Kind != Module::ModuleInterfaceUnit) {
+ // FIXME: Make a better guess as to where to put the module declaration.
+ Diag(getSourceManager().getLocForStartOfFile(
+ getSourceManager().getMainFileID()),
+ diag::err_module_declaration_missing);
+ }
+
// If we are building a module, resolve all of the exported declarations
// now.
if (Module *CurrentModule = PP.getCurrentModule()) {
OpenPOWER on IntegriCloud