Skip to content

Commit adeb8c5

Browse files
committed
Replace getAs with castAs to fix null dereference static analyzer warning.
Use castAs as we know the cast should succeed (and castAs will assert if it doesn't) and we're dereferencing it directly in the BuildRCBlockVarRecordLayout call.
1 parent 336530b commit adeb8c5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,9 +2558,8 @@ void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
25582558
}
25592559
if (FQT->isRecordType() && ElCount) {
25602560
int OldIndex = RunSkipBlockVars.size() - 1;
2561-
const RecordType *RT = FQT->getAs<RecordType>();
2562-
BuildRCBlockVarRecordLayout(RT, BytePos + FieldOffset,
2563-
HasUnion);
2561+
auto *RT = FQT->castAs<RecordType>();
2562+
BuildRCBlockVarRecordLayout(RT, BytePos + FieldOffset, HasUnion);
25642563

25652564
// Replicate layout information for each array element. Note that
25662565
// one element is already done.

0 commit comments

Comments
 (0)