diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-05 22:47:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-05 22:47:05 +0000 |
commit | da0cbc1ad4a553c4de111c1181ec7b42c5ddefce (patch) | |
tree | cb2fd50b55fcab8cb896c12b041f96e95c43e6df /include/clang/Basic | |
parent | a92206ea578983f86fbf1246702955a10056dff8 (diff) |
add support to the diagnostics machinery for mapping warnings and
errors to 'fatal' error severity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63894 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/Diagnostic.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 63dbdd6265..46a8314344 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -56,12 +56,15 @@ namespace clang { /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs /// to either MAP_IGNORE (nothing), MAP_WARNING (emit a warning), MAP_ERROR - /// (emit as an error), or MAP_DEFAULT (handle the default way). + /// (emit as an error), or MAP_DEFAULT (handle the default way). It allows + /// clients to map errors to MAP_ERROR/MAP_DEFAULT or MAP_FATAL (stop + /// emitting diagnostics after this one). enum Mapping { MAP_DEFAULT = 0, //< Do not map this diagnostic. MAP_IGNORE = 1, //< Map this diagnostic to nothing, ignore it. MAP_WARNING = 2, //< Map this diagnostic to a warning. - MAP_ERROR = 3 //< Map this diagnostic to an error. + MAP_ERROR = 3, //< Map this diagnostic to an error. + MAP_FATAL = 4 //< Map this diagnostic to a fatal error. }; } @@ -73,7 +76,7 @@ class Diagnostic { public: /// Level - The level of the diagnostic, after it has been through mapping. enum Level { - Ignored, Note, Warning, Error + Ignored, Note, Warning, Error, Fatal }; enum ArgumentKind { @@ -96,8 +99,8 @@ private: DiagnosticClient *Client; /// DiagMappings - Mapping information for diagnostics. Mapping info is - /// packed into two bits per diagnostic. - unsigned char DiagMappings[diag::DIAG_UPPER_LIMIT/4]; + /// packed into four bits per diagnostic. + unsigned char DiagMappings[diag::DIAG_UPPER_LIMIT/2]; /// ErrorOccurred - This is set to true when an error is emitted, and is /// sticky. @@ -162,16 +165,16 @@ public: assert(Diag < diag::DIAG_UPPER_LIMIT && "Can only map builtin diagnostics"); assert(isBuiltinNoteWarningOrExtension(Diag) && "Cannot map errors!"); - unsigned char &Slot = DiagMappings[Diag/4]; - unsigned Bits = (Diag & 3)*2; - Slot &= ~(3 << Bits); + unsigned char &Slot = DiagMappings[Diag/2]; + unsigned Bits = (Diag & 1)*4; + Slot &= ~(7 << Bits); Slot |= Map << Bits; } /// getDiagnosticMapping - Return the mapping currently set for the specified /// diagnostic. diag::Mapping getDiagnosticMapping(diag::kind Diag) const { - return (diag::Mapping)((DiagMappings[Diag/4] >> (Diag & 3)*2) & 3); + return (diag::Mapping)((DiagMappings[Diag/2] >> (Diag & 1)*4) & 7); } bool hasErrorOccurred() const { return ErrorOccurred; } |