aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-25 01:28:26 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-25 01:28:26 +0000
commit7decebfc7b9dc841f228c93cc2e41e3e62911ff8 (patch)
tree3888e867aa445da37081eecea528019eef96b900 /lib/Basic
parent9e63d4aed8ce544ab105623ad8e36d43e1e11314 (diff)
Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.
For example: t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses] git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/DiagnosticIDs.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index 8725e7f9c0..553e4c9294 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -288,14 +288,15 @@ const char *DiagnosticIDs::getDescription(unsigned DiagID) const {
/// the DiagnosticClient.
DiagnosticIDs::Level
DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
- const Diagnostic &Diag) const {
+ const Diagnostic &Diag,
+ diag::Mapping *mapping) const {
// Handle custom diagnostics, which cannot be mapped.
if (DiagID >= diag::DIAG_UPPER_LIMIT)
return CustomDiagInfo->getLevel(DiagID);
unsigned DiagClass = getBuiltinDiagClass(DiagID);
assert(DiagClass != CLASS_NOTE && "Cannot get diagnostic level of a note!");
- return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag);
+ return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag, mapping);
}
/// \brief Based on the way the client configured the Diagnostic
@@ -307,7 +308,8 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
DiagnosticIDs::Level
DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
SourceLocation Loc,
- const Diagnostic &Diag) const {
+ const Diagnostic &Diag,
+ diag::Mapping *mapping) const {
// Specific non-error diagnostics may be mapped to various levels from ignored
// to error. Errors can only be mapped to fatal.
DiagnosticIDs::Level Result = DiagnosticIDs::Fatal;
@@ -323,6 +325,9 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
MappingInfo = GetDefaultDiagMapping(DiagID);
Diag.setDiagnosticMappingInternal(DiagID, MappingInfo, State, false, false);
}
+
+ if (mapping)
+ *mapping = (diag::Mapping) (MappingInfo & 7);
switch (MappingInfo & 7) {
default: assert(0 && "Unknown mapping!");