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 | d4a3f0e8949647434d8c73e3b563a1cff0b73cfe (patch) | |
tree | 4512b77da6fc9930ad8d71f35259220d1790e214 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | baabe5091c63748d99bf59a1807c2879881b4af2 (diff) | |
download | bcm5719-llvm-d4a3f0e8949647434d8c73e3b563a1cff0b73cfe.tar.gz bcm5719-llvm-d4a3f0e8949647434d8c73e3b563a1cff0b73cfe.zip |
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.
llvm-svn: 211005
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index ed7908dfc92..3f5321664ca 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2119,9 +2119,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, FieldDecl *FD = cast<FieldDecl>(Member); FieldCollector->Add(FD); - if (Diags.getDiagnosticLevel(diag::warn_unused_private_field, - FD->getLocation()) - != DiagnosticsEngine::Ignored) { + if (!Diags.isIgnored(diag::warn_unused_private_field, FD->getLocation())) { // Remember all explicit private FieldDecls that have a name, no side // effects and are not part of a dependent type declaration. if (!FD->isImplicit() && FD->getDeclName() && @@ -2309,9 +2307,8 @@ namespace { static void DiagnoseUninitializedFields( Sema &SemaRef, const CXXConstructorDecl *Constructor) { - if (SemaRef.getDiagnostics().getDiagnosticLevel(diag::warn_field_is_uninit, - Constructor->getLocation()) - == DiagnosticsEngine::Ignored) { + if (SemaRef.getDiagnostics().isIgnored(diag::warn_field_is_uninit, + Constructor->getLocation())) { return; } @@ -3734,9 +3731,8 @@ static void DiagnoseBaseOrMemInitializerOrder( bool ShouldCheckOrder = false; for (unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) { CXXCtorInitializer *Init = Inits[InitIndex]; - if (SemaRef.Diags.getDiagnosticLevel(diag::warn_initializer_out_of_order, - Init->getSourceLocation()) - != DiagnosticsEngine::Ignored) { + if (!SemaRef.Diags.isIgnored(diag::warn_initializer_out_of_order, + Init->getSourceLocation())) { ShouldCheckOrder = true; break; } @@ -5971,8 +5967,7 @@ void Sema::DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD) { if (MD->isInvalidDecl()) return; - if (Diags.getDiagnosticLevel(diag::warn_overloaded_virtual, - MD->getLocation()) == DiagnosticsEngine::Ignored) + if (Diags.isIgnored(diag::warn_overloaded_virtual, MD->getLocation())) return; SmallVector<CXXMethodDecl *, 8> OverloadedMethods; |