diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-09-29 01:58:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-09-29 01:58:05 +0000 |
commit | be1aa410274b28fc143c47c814f07c989f4534d6 (patch) | |
tree | d4072fb4fe99287726865253e3f65492fd8d2ed1 /lib/Basic/Diagnostic.cpp | |
parent | a5e41333b06fdf036d58495490eb14d6a0a3fcf7 (diff) |
Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings.
- This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Diagnostic.cpp')
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index e9abfb733e..5b81458614 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -257,7 +257,10 @@ bool DiagnosticsEngine::setDiagnosticGroupWarningAsError(StringRef Group, DiagnosticMappingInfo &Info = GetCurDiagState()->getOrAddMappingInfo( GroupDiags[i]); - Info.setMapping(diag::MAP_WARNING_NO_WERROR); + if (Info.getMapping() == diag::MAP_ERROR || + Info.getMapping() == diag::MAP_FATAL) + Info.setMapping(diag::MAP_WARNING); + Info.setNoWarningAsError(true); } @@ -284,7 +287,9 @@ bool DiagnosticsEngine::setDiagnosticGroupErrorAsFatal(StringRef Group, DiagnosticMappingInfo &Info = GetCurDiagState()->getOrAddMappingInfo( GroupDiags[i]); - Info.setMapping(diag::MAP_ERROR_NO_WFATAL); + if (Info.getMapping() == diag::MAP_FATAL) + Info.setMapping(diag::MAP_ERROR); + Info.setNoErrorAsFatal(true); } |