This adds the size to forward declared class DITypes, if the size is known.
Fixes an issue where we determine whether to emit fragments based on the
type size, so fragments would sometimes be incorrectly emitted if there
was no size.
Bug: https://bugs.llvm.org/show_bug.cgi?id=47338
Differential Revision: https://reviews.llvm.org/D87062
uint64_t Size = 0;
uint32_t Align = 0;
+ const RecordDecl *D = RD->getDefinition();
+ if (D && D->isCompleteDefinition())
+ Size = CGM.getContext().getTypeSize(Ty);
+
llvm::DINode::DIFlags Flags = llvm::DINode::FlagFwdDecl;
// Add flag to nontrivial forward declarations. To be consistent with MSVC,
// CHECK: [[C_DTOR]] = !DISubprogram(name: "~C"
// CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D"
-// CHECK-NOT: size:
+// CHECK-SAME: size:
// CHECK-SAME: DIFlagFwdDecl
// CHECK-NOT: identifier:
// CHECK-SAME: ){{$}}