diff options
| author | Daniel Jasper <djasper@google.com> | 2017-01-02 22:55:45 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2017-01-02 22:55:45 +0000 |
| commit | 5cad6856a30a20885a4e6a8734cc9ccb0bb9f05c (patch) | |
| tree | 072555ac37986f0162195af705692e2a87a33b8c /clang | |
| parent | 221596df3336a45d635b63293867fb1166a863ca (diff) | |
| download | bcm5719-llvm-5cad6856a30a20885a4e6a8734cc9ccb0bb9f05c.tar.gz bcm5719-llvm-5cad6856a30a20885a4e6a8734cc9ccb0bb9f05c.zip | |
Remove isIgnored()-test that is more expensive than the analysis behind it
In many translation units I have tried, the calls to isIgnored() removed
in this patch are more expensive than doing the analysis that is behind
it. The speed-up in translation units I have tried is between 10 and
20%.
Review: https://reviews.llvm.org/D28208
llvm-svn: 290842
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index facc5d1b375..66a10ef7993 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4244,7 +4244,7 @@ namespace { UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { } bool Visit(QualType T) { - return inherited::Visit(T.getTypePtr()); + return T.isNull() ? false : inherited::Visit(T.getTypePtr()); } #define TYPE(Class, Parent) \ @@ -4497,17 +4497,7 @@ bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param, // // C++11 allows these, and even in C++03 we allow them as an extension with // a warning. - 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) { + if (LangOpts.CPlusPlus11 || Arg->hasUnnamedOrLocalType()) { UnnamedLocalNoLinkageFinder Finder(*this, SR); (void)Finder.Visit(Context.getCanonicalType(Arg)); } |

