Skip to content

Commit 6ee589e

Browse files
committed
[CGObjCMac] Use castAs<> instead of getAs<> to avoid dereference of nullptr inside BuildRCBlockVarRecordLayout
This will assert the cast is correct instead of returning nullptr (UnionType is a subtype of RecordType so this should be clean).
1 parent 7e679f8 commit 6ee589e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@ void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
24872487
if (FQT->isUnionType())
24882488
HasUnion = true;
24892489

2490-
BuildRCBlockVarRecordLayout(FQT->getAs<RecordType>(),
2490+
BuildRCBlockVarRecordLayout(FQT->castAs<RecordType>(),
24912491
BytePos + FieldOffset, HasUnion);
24922492
continue;
24932493
}

0 commit comments

Comments
 (0)