danix800 added inline comments.
================
Comment at: clang/lib/AST/ASTImporter.cpp:2862-2866
+ bool ShouldAddRedecl = !(IsFriendTemplate && IsDependentContext);
+
// We may already have a record of the same name; try to find and match it.
RecordDecl *PrevDecl = nullptr;
if (!DC->isFunctionOrMethod() && !D->isLambda()) {
----------------
balazske wrote:
> The code seems to work but I was confused by the different conditions used
> (is it possible that `IsFriendTemplate` and `ShouldAddRedecl` is true at the
> same time?). I had the observation that if `ShouldAddRedecl` is false we do
> not need the whole search for previous decl. At a friend template we shall
> not find a definition, the loop would just find the last declaration (this
> value is not used). So I have the idea of this code (could not find the
> "suggest edit" command):
>
> ```
> bool DependentFriend = IsFriendTemplate && IsDependentContext;
>
> // We may already have a record of the same name; try to find and match it.
> RecordDecl *PrevDecl = nullptr;
> if (!DependentFriend && !DC->isFunctionOrMethod() && !D->isLambda()) {
>
> ```
This is more clear. Thanks.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155661/new/
https://reviews.llvm.org/D155661
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits