Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 6f68cf4

Browse files
committed
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290842 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 74e1e75 commit 6f68cf4

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Diff for: lib/Sema/SemaTemplate.cpp

+2-12
Original file line numberDiff line numberDiff line change
@@ -4244,7 +4244,7 @@ namespace {
42444244
UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { }
42454245

42464246
bool Visit(QualType T) {
4247-
return inherited::Visit(T.getTypePtr());
4247+
return T.isNull() ? false : inherited::Visit(T.getTypePtr());
42484248
}
42494249

42504250
#define TYPE(Class, Parent) \
@@ -4497,17 +4497,7 @@ bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param,
44974497
//
44984498
// C++11 allows these, and even in C++03 we allow them as an extension with
44994499
// a warning.
4500-
bool NeedsCheck;
4501-
if (LangOpts.CPlusPlus11)
4502-
NeedsCheck =
4503-
!Diags.isIgnored(diag::warn_cxx98_compat_template_arg_unnamed_type,
4504-
SR.getBegin()) ||
4505-
!Diags.isIgnored(diag::warn_cxx98_compat_template_arg_local_type,
4506-
SR.getBegin());
4507-
else
4508-
NeedsCheck = Arg->hasUnnamedOrLocalType();
4509-
4510-
if (NeedsCheck) {
4500+
if (LangOpts.CPlusPlus11 || Arg->hasUnnamedOrLocalType()) {
45114501
UnnamedLocalNoLinkageFinder Finder(*this, SR);
45124502
(void)Finder.Visit(Context.getCanonicalType(Arg));
45134503
}

0 commit comments

Comments
 (0)