diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-09-29 01:01:08 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-09-29 01:01:08 +0000 |
commit | 76101cfe52d1b56974bf0e316247b3201f87c463 (patch) | |
tree | b7f8828634e4b5877550d7d8a1bb4dcc17386dae /lib/Basic/DiagnosticIDs.cpp | |
parent | 80d572d87e2a8258262fd9caa463ae9c046f7bf0 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/DiagnosticIDs.cpp')
-rw-r--r-- | lib/Basic/DiagnosticIDs.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 6e82ba5ff6..9347f9cb17 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/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 { |