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/Sema/SemaTemplate.cpp | |
parent | af3883a24440561c8d82cf26ca6f7bffe2eb4c4d (diff) |
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/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index d6e2fb6166..84c58d12ea 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4161,12 +4161,17 @@ bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param, // // C++11 allows these, and even in C++03 we allow them as an extension with // a warning. - if (LangOpts.CPlusPlus11 ? - Diags.getDiagnosticLevel(diag::warn_cxx98_compat_template_arg_unnamed_type, - SR.getBegin()) != DiagnosticsEngine::Ignored || - Diags.getDiagnosticLevel(diag::warn_cxx98_compat_template_arg_local_type, - SR.getBegin()) != DiagnosticsEngine::Ignored : - Arg->hasUnnamedOrLocalType()) { + bool NeedsCheck; + if (LangOpts.CPlusPlus11) + NeedsCheck = + !Diags.isIgnored(diag::warn_cxx98_compat_template_arg_unnamed_type, + SR.getBegin()) || + !Diags.isIgnored(diag::warn_cxx98_compat_template_arg_local_type, + SR.getBegin()); + else + NeedsCheck = Arg->hasUnnamedOrLocalType(); + + if (NeedsCheck) { UnnamedLocalNoLinkageFinder Finder(*this, SR); (void)Finder.Visit(Context.getCanonicalType(Arg)); } |