[PATCH] D135370: Narrow inline namespace filtration for unqualified friend declarations
Troy Johnson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 08:18:53 PDT 2022
troyj created this revision.
troyj added a reviewer: rsmith.
Herald added a project: All.
troyj requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
rG04ba1856 <https://reviews.llvm.org/rG04ba18563390ec87400fa068a9b4981b235ebaa6> introduced a call to FilterLookupForScope that is expensive for very large translation units where it was observed to cause a 6% compile time degradation. As the comment states, the only effect is to "remove declarations found in inline namespaces for friend declarations with unqualified names." This change limits the call to that scenario. The test that was added by rG04ba1856 <https://reviews.llvm.org/rG04ba18563390ec87400fa068a9b4981b235ebaa6> continues to pass, but the observed degradation is cut in half.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135370
Files:
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2170,9 +2170,11 @@
// Filter out previous declarations that don't match the scope. The only
// effect this has is to remove declarations found in inline namespaces
// for friend declarations with unqualified names.
- SemaRef.FilterLookupForScope(Previous, DC, /*Scope*/ nullptr,
- /*ConsiderLinkage*/ true,
- QualifierLoc.hasQualifier());
+ if (isFriend && !QualifierLoc && !FunctionTemplate) {
+ SemaRef.FilterLookupForScope(Previous, DC, /*Scope*/ nullptr,
+ /*ConsiderLinkage*/ true,
+ QualifierLoc.hasQualifier());
+ }
}
SemaRef.CheckFunctionDeclaration(/*Scope*/ nullptr, Function, Previous,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135370.465744.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221006/2ea2beb1/attachment.bin>
More information about the cfe-commits
mailing list