[cxx-interop] Make the size of anonymous types metadata is unchanged

Add a null pointer to the value witness table instead of completely
skipping emitting the pointer.
This commit is contained in:
Gabor Horvath
2025-09-08 11:46:24 +01:00
parent aa3a0756f4
commit cae23fd098

View File

@@ -6940,11 +6940,13 @@ namespace {
}
void addValueWitnessTable() {
llvm::Constant* vwtPointer = nullptr;
if (auto cd = Target->getClangDecl())
if (auto rd = dyn_cast<clang::RecordDecl>(cd))
if (rd->isAnonymousStructOrUnion())
return;
auto vwtPointer = emitValueWitnessTable(/*relative*/ false).getValue();
vwtPointer = llvm::Constant::getNullValue(IGM.WitnessTablePtrTy);
if (!vwtPointer)
vwtPointer = emitValueWitnessTable(/*relative*/ false).getValue();
B.addSignedPointer(vwtPointer,
IGM.getOptions().PointerAuth.ValueWitnessTable,
PointerAuthEntity());