[cfe-commits] r57731 - /cfe/trunk/lib/Basic/Diagnostic.cpp
Chris Lattner
sabre at nondot.org
Fri Oct 17 14:24:47 PDT 2008
Author: lattner
Date: Fri Oct 17 16:24:47 2008
New Revision: 57731
URL: http://llvm.org/viewvc/llvm-project?rev=57731&view=rev
Log:
fix rdar://6288301: custom warnings don't respect -Werror.
Modified:
cfe/trunk/lib/Basic/Diagnostic.cpp
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=57731&r1=57730&r2=57731&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Fri Oct 17 16:24:47 2008
@@ -85,7 +85,8 @@
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 @@
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 @@
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);
}
More information about the cfe-commits
mailing list