From c2d70a3098bf78d67d8ab64f21b2e6a730f9250b Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Fri, 21 Oct 2016 23:27:37 +0000 Subject: [PATCH] Module: improve the diagnostic message for include of non-modular header. Emit the actual path to the non-modular include. rdar://28897010 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284897 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticLexKinds.td | 4 ++-- lib/Lex/ModuleMap.cpp | 3 ++- test/Modules/incomplete-module.m | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 604d51db1f..fa5aa0e7da 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -659,10 +659,10 @@ def warn_use_of_private_header_outside_module : Warning< def err_undeclared_use_of_module : Error< "module %0 does not depend on a module exporting '%1'">; def warn_non_modular_include_in_framework_module : Warning< - "include of non-modular header inside framework module '%0'">, + "include of non-modular header inside framework module '%0': '%1'">, InGroup, DefaultIgnore; def warn_non_modular_include_in_module : Warning< - "include of non-modular header inside module '%0'">, + "include of non-modular header inside module '%0': '%1'">, InGroup, DefaultIgnore; def warn_module_conflict : Warning< "module '%0' conflicts with already-imported module '%1': %2">, diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 429b2cc073..6a261a1154 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -303,7 +303,8 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule, diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ? diag::warn_non_modular_include_in_framework_module : diag::warn_non_modular_include_in_module; - Diags.Report(FilenameLoc, DiagID) << RequestingModule->getFullModuleName(); + Diags.Report(FilenameLoc, DiagID) << RequestingModule->getFullModuleName() + << File->getName(); } } diff --git a/test/Modules/incomplete-module.m b/test/Modules/incomplete-module.m index e338a40c9a..ffb2708c6f 100644 --- a/test/Modules/incomplete-module.m +++ b/test/Modules/incomplete-module.m @@ -2,7 +2,7 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules-cache-path=%t -Wincomplete-module -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s -// CHECK: warning: include of non-modular header inside module 'incomplete_mod' +// CHECK: warning: include of non-modular header inside module 'incomplete_mod': {{'.*incomplete_mod_missing.h'}} // RUN: rm -rf %t // RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules-strict-decluse -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DECLUSE -- 2.40.0