r197389 - Revert "Modules: Make missing headers in a module.map a warning not an error."
Daniel Jasper
djasper at google.com
Mon Dec 16 06:57:22 PST 2013
Author: djasper
Date: Mon Dec 16 08:57:22 2013
New Revision: 197389
URL: http://llvm.org/viewvc/llvm-project?rev=197389&view=rev
Log:
Revert "Modules: Make missing headers in a module.map a warning not an error."
This was committed accidentally.
Added:
cfe/trunk/test/Modules/Inputs/declare-use/module.map
- copied, changed from r197388, cfe/trunk/test/Modules/Inputs/declare-use/custom.map
Removed:
cfe/trunk/test/Modules/Inputs/declare-use/custom.map
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/test/Modules/Inputs/modular_maps/modulea.map
cfe/trunk/test/Modules/modular_maps.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Dec 16 08:57:22 2013
@@ -207,7 +207,6 @@ def MismatchedReturnTypes : DiagGroup<"m
def MismatchedTags : DiagGroup<"mismatched-tags">;
def MissingFieldInitializers : DiagGroup<"missing-field-initializers">;
def ModuleConflict : DiagGroup<"module-conflict">;
-def ModuleMapWarnings : DiagGroup<"module-map-warnings">;
def NewlineEOF : DiagGroup<"newline-eof">;
def NullArithmetic : DiagGroup<"null-arithmetic">;
def NullCharacter : DiagGroup<"null-character">;
@@ -490,7 +489,6 @@ def Most : DiagGroup<"most", [
Implicit,
MismatchedTags,
MissingBraces,
- ModuleMapWarnings,
MultiChar,
Reorder,
ReturnType,
Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Mon Dec 16 08:57:22 2013
@@ -551,6 +551,8 @@ def err_mmap_expected_mmap_file : Error<
def err_mmap_module_redefinition : Error<
"redefinition of module '%0'">;
def note_mmap_prev_definition : Note<"previously defined here">;
+def err_mmap_header_not_found : Error<
+ "%select{|umbrella }0header '%1' not found">;
def err_mmap_umbrella_dir_not_found : Error<
"umbrella directory '%0' not found">;
def err_mmap_umbrella_clash : Error<
@@ -597,9 +599,6 @@ def err_mmap_expected_feature : Error<"e
def err_mmap_expected_attribute : Error<"expected an attribute name">;
def warn_mmap_unknown_attribute : Warning<"unknown attribute '%0'">,
InGroup<IgnoredAttributes>;
-def warn_mmap_header_not_found :
- Warning<"%select{|umbrella }0header '%1' not found">,
- InGroup<ModuleMapWarnings>;
def warn_auto_module_import : Warning<
"treating #%select{include|import|include_next|__include_macros}0 as an "
Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Mon Dec 16 08:57:22 2013
@@ -38,7 +38,7 @@ class ModuleMapParser;
class ModuleMap {
SourceManager &SourceMgr;
- DiagnosticsEngine &Diags;
+ IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
const LangOptions &LangOpts;
const TargetInfo *Target;
HeaderSearch &HeaderInfo;
@@ -188,7 +188,7 @@ public:
/// \param LangOpts Language options for this translation unit.
///
/// \param Target The target for this translation unit.
- ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
+ ModuleMap(SourceManager &SourceMgr, DiagnosticConsumer &DC,
const LangOptions &LangOpts, const TargetInfo *Target,
HeaderSearch &HeaderInfo);
Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Dec 16 08:57:22 2013
@@ -48,7 +48,7 @@ HeaderSearch::HeaderSearch(IntrusiveRefC
const LangOptions &LangOpts,
const TargetInfo *Target)
: HSOpts(HSOpts), FileMgr(SourceMgr.getFileManager()), FrameworkMap(64),
- ModMap(SourceMgr, Diags, LangOpts, Target, *this)
+ ModMap(SourceMgr, *Diags.getClient(), LangOpts, Target, *this)
{
AngledDirIdx = 0;
SystemDirIdx = 0;
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Mon Dec 16 08:57:22 2013
@@ -59,7 +59,7 @@ Module *ModuleMap::resolveModuleId(const
Module *Context = lookupModuleUnqualified(Id[0].first, Mod);
if (!Context) {
if (Complain)
- Diags.Report(Id[0].second, diag::err_mmap_missing_module_unqualified)
+ Diags->Report(Id[0].second, diag::err_mmap_missing_module_unqualified)
<< Id[0].first << Mod->getFullModuleName();
return 0;
@@ -70,7 +70,7 @@ Module *ModuleMap::resolveModuleId(const
Module *Sub = lookupModuleQualified(Id[I].first, Context);
if (!Sub) {
if (Complain)
- Diags.Report(Id[I].second, diag::err_mmap_missing_module_qualified)
+ Diags->Report(Id[I].second, diag::err_mmap_missing_module_qualified)
<< Id[I].first << Context->getFullModuleName()
<< SourceRange(Id[0].second, Id[I-1].second);
@@ -83,12 +83,19 @@ Module *ModuleMap::resolveModuleId(const
return Context;
}
-ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
+ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticConsumer &DC,
const LangOptions &LangOpts, const TargetInfo *Target,
HeaderSearch &HeaderInfo)
- : SourceMgr(SourceMgr), Diags(Diags), LangOpts(LangOpts), Target(Target),
+ : SourceMgr(SourceMgr), LangOpts(LangOpts), Target(Target),
HeaderInfo(HeaderInfo), BuiltinIncludeDir(0), CompilingModule(0),
- SourceModule(0) {}
+ SourceModule(0) {
+ IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
+ Diags = IntrusiveRefCntPtr<DiagnosticsEngine>(
+ new DiagnosticsEngine(DiagIDs, new DiagnosticOptions));
+ Diags->setClient(new ForwardingDiagnosticConsumer(DC),
+ /*ShouldOwnClient=*/true);
+ Diags->setSourceManager(&SourceMgr);
+}
ModuleMap::~ModuleMap() {
for (llvm::StringMap<Module *>::iterator I = Modules.begin(),
@@ -1571,11 +1578,9 @@ void ModuleMapParser::parseHeaderDecl(MM
} else if (LeadingToken != MMToken::ExcludeKeyword) {
// Ignore excluded header files. They're optional anyway.
- // If we find a module that has a missing header, we mark this module as
- // unavailable. Layering warnings like -fmodules-decluse can still be used.
- ActiveModule->IsAvailable = false;
- Diags.Report(FileNameLoc, diag::warn_mmap_header_not_found)
+ Diags.Report(FileNameLoc, diag::err_mmap_header_not_found)
<< (LeadingToken == MMToken::UmbrellaKeyword) << FileName;
+ HadError = true;
}
}
@@ -2114,9 +2119,11 @@ bool ModuleMap::parseModuleMapFile(const
// Parse this module map file.
Lexer L(ID, SourceMgr.getBuffer(ID), SourceMgr, MMapLangOpts);
- ModuleMapParser Parser(L, SourceMgr, Target, Diags, *this, File->getDir(),
+ Diags->getClient()->BeginSourceFile(MMapLangOpts);
+ ModuleMapParser Parser(L, SourceMgr, Target, *Diags, *this, File->getDir(),
BuiltinIncludeDir, IsSystem);
bool Result = Parser.parseModuleMapFile();
+ Diags->getClient()->EndSourceFile();
ParsedModuleMap[File] = Result;
return Result;
}
Removed: cfe/trunk/test/Modules/Inputs/declare-use/custom.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/declare-use/custom.map?rev=197388&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/declare-use/custom.map (original)
+++ cfe/trunk/test/Modules/Inputs/declare-use/custom.map (removed)
@@ -1,46 +0,0 @@
-module XA {
- header "a.h"
-}
-
-module XB {
- header "b.h"
-}
-
-module XC {
- header "c.h"
- use XA
- // Intentionally doesn't use XB to show that -fdecl-use isn't transitive.
-}
-
-module XD {
- header "d.h"
- use XA
- // Intentionally doesn't use XB to show that -fdecl-use isn't transitive.
-}
-
-module XE {
- header "e.h"
- use XA
- use XB
-}
-
-module XF {
- header "f.h"
- header "missing.h"
- use XA
- use XB
-}
-
-module XG {
- header "g.h"
- header "g1.h"
- use XC
- use XE
-}
-
-module XH {
- header "h.h"
- header "h1.h"
- use XC
- use XE
-}
Copied: cfe/trunk/test/Modules/Inputs/declare-use/module.map (from r197388, cfe/trunk/test/Modules/Inputs/declare-use/custom.map)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/declare-use/module.map?p2=cfe/trunk/test/Modules/Inputs/declare-use/module.map&p1=cfe/trunk/test/Modules/Inputs/declare-use/custom.map&r1=197388&r2=197389&rev=197389&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/declare-use/custom.map (original)
+++ cfe/trunk/test/Modules/Inputs/declare-use/module.map Mon Dec 16 08:57:22 2013
@@ -26,7 +26,6 @@ module XE {
module XF {
header "f.h"
- header "missing.h"
use XA
use XB
}
Modified: cfe/trunk/test/Modules/Inputs/modular_maps/modulea.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/modular_maps/modulea.map?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/modular_maps/modulea.map (original)
+++ cfe/trunk/test/Modules/Inputs/modular_maps/modulea.map Mon Dec 16 08:57:22 2013
@@ -1,7 +1,6 @@
module A {
header "common.h"
header "a.h"
- header "doesnotexists.h"
}
extern module B "moduleb.map"
Modified: cfe/trunk/test/Modules/modular_maps.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/modular_maps.cpp?rev=197389&r1=197388&r2=197389&view=diff
==============================================================================
--- cfe/trunk/test/Modules/modular_maps.cpp (original)
+++ cfe/trunk/test/Modules/modular_maps.cpp Mon Dec 16 08:57:22 2013
@@ -1,7 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fmodule-maps -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -I %S/Inputs/modular_maps %s -verify
-
-// expected-warning at Inputs/modular_maps/modulea.map:4{{header 'doesnotexists.h' not found}}
+// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -I %S/Inputs/modular_maps %s -verify
#include "common.h"
#include "a.h"
More information about the cfe-commits
mailing list