diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-17 21:24:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-17 21:24:47 +0000 |
commit | a1f23cc7f5dae8b71b8ee631994274609d35eb89 (patch) | |
tree | 2b19886f7962117ca15519a90872a4880abc13d7 | |
parent | c5234715f145b5fa0a3a08fed33b83a3203728ae (diff) |
fix rdar://6288301: custom warnings don't respect -Werror.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57731 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 0f8f314f15..c3ff10d427 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -85,7 +85,8 @@ namespace clang { return DiagInfo[DiagID-diag::NUM_BUILTIN_DIAGNOSTICS].first; } - unsigned getOrCreateDiagID(Diagnostic::Level L, const char *Message) { + unsigned getOrCreateDiagID(Diagnostic::Level L, const char *Message, + Diagnostic &Diags) { DiagDesc D(L, Message); // Check to see if it already exists. std::map<DiagDesc, unsigned>::iterator I = DiagIDs.lower_bound(D); @@ -96,6 +97,11 @@ namespace clang { unsigned ID = DiagInfo.size()+diag::NUM_BUILTIN_DIAGNOSTICS; DiagIDs.insert(std::make_pair(D, ID)); DiagInfo.push_back(D); + + // If this is a warning, and all warnings are supposed to map to errors, + // insert the mapping now. + if (L == Diagnostic::Warning && Diags.getWarningsAsErrors()) + Diags.setDiagnosticMapping((diag::kind)ID, diag::MAP_ERROR); return ID; } }; @@ -133,7 +139,7 @@ Diagnostic::~Diagnostic() { unsigned Diagnostic::getCustomDiagID(Level L, const char *Message) { if (CustomDiagInfo == 0) CustomDiagInfo = new diag::CustomDiagInfo(); - return CustomDiagInfo->getOrCreateDiagID(L, Message); + return CustomDiagInfo->getOrCreateDiagID(L, Message, *this); } |