Skip to content

Commit cdf3817

Browse files
committed
[gardening] Extracted common expression to value.
1 parent 52cf749 commit cdf3817

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,9 +3682,11 @@ ConstantReference IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
36823682

36833683
llvm::Type *defaultVarTy;
36843684
unsigned adjustmentIndex;
3685-
3685+
3686+
bool fullMetadata = (nominal && requiresForeignTypeMetadata(nominal));
3687+
36863688
// Foreign classes reference the full metadata with a GEP.
3687-
if (nominal && requiresForeignTypeMetadata(nominal)) {
3689+
if (fullMetadata) {
36883690
defaultVarTy = FullTypeMetadataStructTy;
36893691
adjustmentIndex = MetadataAdjustmentIndex::ValueType;
36903692
// The symbol for other nominal type metadata is generated at the address
@@ -3712,7 +3714,7 @@ ConstantReference IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
37123714
Optional<LinkEntity> entity;
37133715
DebugTypeInfo DbgTy;
37143716

3715-
if (nominal && requiresForeignTypeMetadata(nominal)) {
3717+
if (fullMetadata) {
37163718
entity = LinkEntity::forTypeMetadata(concreteType,
37173719
TypeMetadataAddress::FullMetadata);
37183720
DbgTy = DebugTypeInfo::getMetadata(MetatypeType::get(concreteType),

0 commit comments

Comments
 (0)