summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/DiagnosticIDs.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-09-29 01:01:08 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-09-29 01:01:08 +0000
commitaa11138543d419a5152b35564d59a853687fa7fc (patch)
tree9f7a159e6c4490c8265e87f4499dfe3c94afa485 /clang/lib/Basic/DiagnosticIDs.cpp
parentcc5f8d45173668385d047c7538acd92ba501e2df (diff)
downloadbcm5719-llvm-aa11138543d419a5152b35564d59a853687fa7fc.tar.gz
bcm5719-llvm-aa11138543d419a5152b35564d59a853687fa7fc.zip
Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
- The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though. llvm-svn: 140752
Diffstat (limited to 'clang/lib/Basic/DiagnosticIDs.cpp')
-rw-r--r--clang/lib/Basic/DiagnosticIDs.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index 6e82ba5ff62..9347f9cb170 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -458,6 +458,13 @@ bool DiagnosticIDs::isBuiltinExtensionDiag(unsigned DiagID,
return true;
}
+bool DiagnosticIDs::isDefaultMappingAsError(unsigned DiagID) {
+ if (DiagID >= diag::DIAG_UPPER_LIMIT)
+ return false;
+
+ return GetDefaultDiagMapping(DiagID) == diag::MAP_ERROR;
+}
+
/// getDescription - Given a diagnostic ID, return a description of the
/// issue.
StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
OpenPOWER on IntegriCloud