Skip to content

Commit 41fa97f

Browse files
committed
[IRGen] Add convenience to define transient types.
Expose the createStructType helper to clients of IRGenModule which want to define types which won't ever be used elsewhere. This is just a convenience--such clients could already have directly used the API on llvm::Module directly.
1 parent f754028 commit 41fa97f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ static llvm::StructType *createStructType(IRGenModule &IGM,
9191
name, packed);
9292
}
9393

94+
llvm::StructType *IRGenModule::createTransientStructType(
95+
StringRef name, std::initializer_list<llvm::Type *> types, bool packed) {
96+
return createStructType(*this, name, types, packed);
97+
}
98+
9499
static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
95100
llvm::LLVMContext &LLVMContext,
96101
const IRGenOptions &Opts,

lib/IRGen/IRGenModule.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,11 @@ class IRGenModule {
861861
llvm::Constant *swiftImmortalRefCount = nullptr;
862862
llvm::Constant *swiftStaticArrayMetadata = nullptr;
863863

864+
llvm::StructType *
865+
createTransientStructType(StringRef name,
866+
std::initializer_list<llvm::Type *> types,
867+
bool packed = false);
868+
864869
/// Used to create unique names for class layout types with tail allocated
865870
/// elements.
866871
unsigned TailElemTypeID = 0;

0 commit comments

Comments
 (0)