summaryrefslogtreecommitdiff
path: root/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-04-11 11:47:45 +0000
committerDaniel Jasper <djasper@google.com>2014-04-11 11:47:45 +0000
commit0e1ed6bc355fa2e5d967c82c4124b1674e0131d2 (patch)
treeb1275002d29a63f7875c21ccd1aa25dc9a1c44b1 /lib/Lex/ModuleMap.cpp
parent6699b197f657547e9f3fd1ad699df68d8a19dc52 (diff)
downloadclang-0e1ed6bc355fa2e5d967c82c4124b1674e0131d2.tar.gz
clang-0e1ed6bc355fa2e5d967c82c4124b1674e0131d2.tar.bz2
clang-0e1ed6bc355fa2e5d967c82c4124b1674e0131d2.tar.xz
Add -fmodules-strict-decluse to check that all headers are in modules
Review: http://reviews.llvm.org/D3335 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/ModuleMap.cpp')
-rw-r--r--lib/Lex/ModuleMap.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp
index f0dcc1a149..689ef73b46 100644
--- a/lib/Lex/ModuleMap.cpp
+++ b/lib/Lex/ModuleMap.cpp
@@ -243,8 +243,12 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
resolveUses(RequestingModule, /*Complain=*/false);
HeadersMap::iterator Known = findKnownHeader(File);
- if (Known == Headers.end())
+ if (Known == Headers.end()) {
+ if (LangOpts.ModulesStrictDeclUse)
+ Diags.Report(FilenameLoc, diag::error_undeclared_use_of_module)
+ << RequestingModule->getFullModuleName() << Filename;
return;
+ }
Module *Private = NULL;
Module *NotUsed = NULL;