diff options
author | Alp Toker <alp@nuanti.com> | 2014-06-15 23:30:39 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-06-15 23:30:39 +0000 |
commit | 7225802bf998624a54e48d81e2d6241cfc8c2b2b (patch) | |
tree | b918afa8ea25c87835b43f03cde4dda107d575d2 /lib/Lex/PPLexerChange.cpp | |
parent | af3883a24440561c8d82cf26ca6f7bffe2eb4c4d (diff) | |
download | clang-7225802bf998624a54e48d81e2d6241cfc8c2b2b.tar.gz clang-7225802bf998624a54e48d81e2d6241cfc8c2b2b.tar.bz2 clang-7225802bf998624a54e48d81e2d6241cfc8c2b2b.tar.xz |
Hide the concept of diagnostic levels from lex, parse and sema
The compilation pipeline doesn't actually need to know about the high-level
concept of diagnostic mappings, and hiding the final computed level presents
several simplifications and other potential benefits.
The only exceptions are opportunistic checks to see whether expensive code
paths can be avoided for diagnostics that are guaranteed to be ignored at a
certain SourceLocation.
This commit formalizes that invariant by introducing and using
DiagnosticsEngine::isIgnored() in place of individual level checks throughout
lex, parse and sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index 40d15d4bfa..81bb077632 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -449,9 +449,8 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { SourceLocation StartLoc = SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()); - if (getDiagnostics().getDiagnosticLevel( - diag::warn_uncovered_module_header, - StartLoc) != DiagnosticsEngine::Ignored) { + if (!getDiagnostics().isIgnored(diag::warn_uncovered_module_header, + StartLoc)) { ModuleMap &ModMap = getHeaderSearchInfo().getModuleMap(); typedef llvm::sys::fs::recursive_directory_iterator recursive_directory_iterator; @@ -486,9 +485,8 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { // mentioned at all in the module map. Such headers SourceLocation StartLoc = SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()); - if (getDiagnostics().getDiagnosticLevel(diag::warn_forgotten_module_header, - StartLoc) - != DiagnosticsEngine::Ignored) { + if (!getDiagnostics().isIgnored(diag::warn_forgotten_module_header, + StartLoc)) { ModuleMap &ModMap = getHeaderSearchInfo().getModuleMap(); for (unsigned I = 0, N = SourceMgr.local_sloc_entry_size(); I != N; ++I) { // We only care about file entries. |