[PATCH] D148274: [clang] Fix overly aggressive lifetime checks for parenthesized aggregate initialization
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 14 14:11:36 PDT 2023
shafik added inline comments.
================
Comment at: clang/include/clang/Sema/Initialization.h:400
+ static InitializedEntity InitializeMemberFromParenAggInit(FieldDecl *Member) {
+ return InitializedEntity(Member, nullptr, false, false, true);
+ }
----------------
================
Comment at: clang/include/clang/Sema/Initialization.h:509
bool isImplicitMemberInitializer() const {
- return getKind() == EK_Member && Variable.IsImplicitFieldInit;
+ return (getKind() == EK_Member || getKind() == EK_ParenAggInitMember) &&
+ Variable.IsImplicitFieldInit;
----------------
Does this really apply? It looks like this function is only used in `canPerformArrayCopy`
================
Comment at: clang/lib/Sema/SemaAccess.cpp:1657
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
PD = PDiag(diag::err_access_field_ctor);
PD << Field->getType() << getSpecialMember(Constructor);
----------------
It looks like don't have a test that triggers this diagnostic, I was looking for `field of type.*has.*`
================
Comment at: clang/lib/Sema/SemaInit.cpp:583
+ EK == InitializedEntity::EK_Member ||
+ EK == InitializedEntity::EK_ParenAggInitMember)
SemaRef.Diag(Entity.getDecl()->getLocation(),
----------------
I don't see a test triggering this diagnostic for parens init.
================
Comment at: clang/lib/Sema/SemaInit.cpp:597
+ EK == InitializedEntity::EK_Member ||
+ EK == InitializedEntity::EK_ParenAggInitMember)
SemaRef.Diag(Entity.getDecl()->getLocation(),
----------------
I don't see a test triggering this diagnostic for parens init.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148274/new/
https://reviews.llvm.org/D148274
More information about the cfe-commits
mailing list