From 6caebfda785057ec0a2c18353debdbe20b2b33e4 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Wed, 5 Nov 2014 16:43:18 +0000 Subject: [PATCH] Remove superceded warning warn_forgotten_module_header This DefaultIgnore warning under -Wincomplete-module was firing on any module map files that happened to be parsed (it's only supposed to fire on headers), and it has been superceded by -Wnon-modular-include-in-module anyway. For compatibility, I rewired -Wincomplete-module to imply -Wnon-modular-include-in-module. llvm-svn: 221357 --- clang/include/clang/Basic/DiagnosticGroups.td | 4 +++- clang/include/clang/Basic/DiagnosticLexKinds.td | 3 --- clang/lib/Lex/PPLexerChange.cpp | 28 ------------------------- clang/test/Modules/incomplete-module.m | 6 +++++- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 7a813b0..cc4508a 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -201,11 +201,13 @@ def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types", [IncompatiblePointerTypesDiscardsQualifiers]>; def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">; -def IncompleteModule : DiagGroup<"incomplete-module", [IncompleteUmbrella]>; def NonModularIncludeInFrameworkModule : DiagGroup<"non-modular-include-in-framework-module">; def NonModularIncludeInModule : DiagGroup<"non-modular-include-in-module", [NonModularIncludeInFrameworkModule]>; +def IncompleteModule : DiagGroup<"incomplete-module", + [IncompleteUmbrella, NonModularIncludeInModule]>; + def InvalidNoreturn : DiagGroup<"invalid-noreturn">; def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">; def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">; diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index 9e5541a..9bc27ab 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -615,9 +615,6 @@ def warn_auto_module_import : Warning< def warn_uncovered_module_header : Warning< "umbrella header for module '%0' does not include header '%1'">, InGroup; -def warn_forgotten_module_header : Warning< - "header '%0' is included in module '%1' but not listed in module map">, - InGroup, DefaultIgnore; def err_expected_id_building_module : Error< "expected a module name in '__building_module' expression">; def error_use_of_private_header_outside_module : Error< diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 33256ec..fb5e2b0 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -499,34 +499,6 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { } } } - - // Check whether there are any headers that were included, but not - // mentioned at all in the module map. Such headers - SourceLocation StartLoc - = SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()); - if (!getDiagnostics().isIgnored(diag::warn_forgotten_module_header, - StartLoc)) { - ModuleMap &ModMap = getHeaderSearchInfo().getModuleMap(); - for (unsigned I = 0, N = SourceMgr.local_sloc_entry_size(); I != N; ++I) { - // We only care about file entries. - const SrcMgr::SLocEntry &Entry = SourceMgr.getLocalSLocEntry(I); - if (!Entry.isFile()) - continue; - - // Dig out the actual file. - const FileEntry *File = Entry.getFile().getContentCache()->OrigEntry; - if (!File) - continue; - - // If it's not part of a module and not unknown, complain. - if (!ModMap.findModuleForHeader(File, nullptr, - /*IncludeTextualHeaders*/true) && - !ModMap.isHeaderInUnavailableModule(File)) { - Diag(StartLoc, diag::warn_forgotten_module_header) - << File->getName() << Mod->getFullModuleName(); - } - } - } } return true; diff --git a/clang/test/Modules/incomplete-module.m b/clang/test/Modules/incomplete-module.m index 8edaea9..8181ae8 100644 --- a/clang/test/Modules/incomplete-module.m +++ b/clang/test/Modules/incomplete-module.m @@ -2,4 +2,8 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules-cache-path=%t -Wincomplete-module -fmodules -I %S/Inputs %s 2>&1 | FileCheck %s -// CHECK: {{warning: header '.*incomplete_mod_missing.h' is included in module 'incomplete_mod' but not listed in module map}} +// CHECK: warning: include of non-modular header inside module 'incomplete_mod' + +// RUN: rm -rf %t +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules-strict-decluse -fmodules -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DECLUSE +// DECLUSE: error: module incomplete_mod does not depend on a module exporting {{'.*incomplete_mod_missing.h'}} -- 2.7.4