From 0e1ed6bc355fa2e5d967c82c4124b1674e0131d2 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 11 Apr 2014 11:47:45 +0000 Subject: 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 --- lib/Lex/ModuleMap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/Lex/ModuleMap.cpp') 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; -- cgit v1.2.3