llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> The Record constructor has a parameter and a class member of the same name. Also include composite array element types in the calculation in Program.cpp. --- Full diff: https://github.com/llvm/llvm-project/pull/184557.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Program.cpp (+8-6) - (modified) clang/lib/AST/ByteCode/Record.cpp (+4-4) ``````````diff diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp index 7eebb303d8553..7364e9405efe2 100644 --- a/clang/lib/AST/ByteCode/Program.cpp +++ b/clang/lib/AST/ByteCode/Program.cpp @@ -376,14 +376,16 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) { Desc = createDescriptor(FD, *T, nullptr, std::nullopt, IsConst, /*isTemporary=*/false, IsMutable, IsVolatile); HasPtrField = HasPtrField || (T == PT_Ptr); + } else if ((Desc = createDescriptor( + FD, FT.getTypePtr(), std::nullopt, IsConst, + /*isTemporary=*/false, IsMutable, IsVolatile))) { + HasPtrField = + HasPtrField || + (Desc->isPrimitiveArray() && Desc->getPrimType() == PT_Ptr) || + (Desc->ElemRecord && Desc->ElemRecord->hasPtrField()); } else { - Desc = createDescriptor(FD, FT.getTypePtr(), std::nullopt, IsConst, - /*isTemporary=*/false, IsMutable, IsVolatile); - HasPtrField = HasPtrField || (Desc && Desc->isPrimitiveArray() && - Desc->getPrimType() == PT_Ptr); - } - if (!Desc) return nullptr; + } Fields.emplace_back(FD, Desc, BaseSize); BaseSize += align(Desc->getAllocSize()); } diff --git a/clang/lib/AST/ByteCode/Record.cpp b/clang/lib/AST/ByteCode/Record.cpp index f0ec33f54901c..13a5ffb85787c 100644 --- a/clang/lib/AST/ByteCode/Record.cpp +++ b/clang/lib/AST/ByteCode/Record.cpp @@ -24,13 +24,13 @@ Record::Record(const RecordDecl *Decl, BaseList &&SrcBases, for (Base &B : Bases) { BaseMap[B.Decl] = &B; - if (!HasPtrField) - HasPtrField |= B.R->hasPtrField(); + if (!this->HasPtrField) + this->HasPtrField |= B.R->hasPtrField(); } for (Base &V : VirtualBases) { VirtualBaseMap[V.Decl] = &V; - if (!HasPtrField) - HasPtrField |= V.R->hasPtrField(); + if (!this->HasPtrField) + this->HasPtrField |= V.R->hasPtrField(); } } `````````` </details> https://github.com/llvm/llvm-project/pull/184557 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
