Skip to content

Commit f78f226

Browse files
committed
NFC, extract param & return type for type metadata access function to accessors for reuse
They will be reused to provide information about the signature of the type metadata access function to the Clang printer for C++ interop
1 parent 6cc8359 commit f78f226

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,6 +4352,14 @@ IRGenModule::getAddrOfObjCResilientClassStub(ClassDecl *classDecl,
43524352
return getAddrOfLLVMVariable(entity, forDefinition, DebugTypeInfo());
43534353
}
43544354

4355+
llvm::IntegerType *IRGenModule::getTypeMetadataRequestParamTy() {
4356+
return SizeTy;
4357+
}
4358+
4359+
llvm::StructType *IRGenModule::getTypeMetadataResponseTy() {
4360+
return TypeMetadataResponseTy;
4361+
}
4362+
43554363
/// Fetch the type metadata access function for a non-generic type.
43564364
llvm::Function *
43574365
IRGenModule::getAddrOfTypeMetadataAccessFunction(CanType type,
@@ -4367,8 +4375,9 @@ IRGenModule::getAddrOfTypeMetadataAccessFunction(CanType type,
43674375
return entry;
43684376
}
43694377

4370-
llvm::Type *params[] = { SizeTy }; // MetadataRequest
4371-
auto fnType = llvm::FunctionType::get(TypeMetadataResponseTy, params, false);
4378+
llvm::Type *params[] = {getTypeMetadataRequestParamTy()}; // MetadataRequest
4379+
auto fnType =
4380+
llvm::FunctionType::get(getTypeMetadataResponseTy(), params, false);
43724381
Signature signature(fnType, llvm::AttributeList(), SwiftCC);
43734382
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
43744383
entry = createFunction(*this, link, signature);

lib/IRGen/IRGenModule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,9 @@ class IRGenModule {
874874
llvm::PointerType *getValueWitnessTablePtrTy();
875875
llvm::PointerType *getEnumValueWitnessTablePtrTy();
876876

877+
llvm::IntegerType *getTypeMetadataRequestParamTy();
878+
llvm::StructType *getTypeMetadataResponseTy();
879+
877880
void unimplemented(SourceLoc, StringRef Message);
878881
[[noreturn]]
879882
void fatal_unimplemented(SourceLoc, StringRef Message);

0 commit comments

Comments
 (0)