aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-02-13 15:16:56 +0000
committerMike Stump <mrs@apple.com>2009-02-13 15:16:56 +0000
commitab695143861b520f5c9f8f982534a71d355396f1 (patch)
treea04692348a24659fb1bd91597f7d0a1ac964643b /lib/CodeGen/CGBlocks.cpp
parentdae4413d77b3e7599ce81307eb7a7d1dedbac547 (diff)
Move BlockDescriptorType into CGM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r--lib/CodeGen/CGBlocks.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index 9aa5207a44..cb096fcacc 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -26,25 +26,25 @@ enum {
IsGlobal = 1 << 28
};
-static const llvm::Type *getBlockDescriptorType(CodeGenModule &CGM) {
- static const llvm::Type *Ty = 0;
-
- if (!Ty) {
- const llvm::Type *UnsignedLongTy =
- CGM.getTypes().ConvertType(CGM.getContext().UnsignedLongTy);
-
- // struct __block_descriptor {
- // unsigned long reserved;
- // unsigned long block_size;
- // };
- Ty = llvm::StructType::get(UnsignedLongTy,
- UnsignedLongTy,
- NULL);
+const llvm::Type *CodeGenModule::getBlockDescriptorType() {
+ if (BlockDescriptorType)
+ return BlockDescriptorType;
+
+ const llvm::Type *UnsignedLongTy =
+ getTypes().ConvertType(getContext().UnsignedLongTy);
- CGM.getModule().addTypeName("struct.__block_descriptor", Ty);
- }
-
- return Ty;
+ // struct __block_descriptor {
+ // unsigned long reserved;
+ // unsigned long block_size;
+ // };
+ BlockDescriptorType = llvm::StructType::get(UnsignedLongTy,
+ UnsignedLongTy,
+ NULL);
+
+ getModule().addTypeName("struct.__block_descriptor",
+ BlockDescriptorType);
+
+ return BlockDescriptorType;
}
static const llvm::Type *getGenericBlockLiteralType(CodeGenModule &CGM) {
@@ -55,7 +55,7 @@ static const llvm::Type *getGenericBlockLiteralType(CodeGenModule &CGM) {
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
const llvm::Type *BlockDescPtrTy =
- llvm::PointerType::getUnqual(getBlockDescriptorType(CGM));
+ llvm::PointerType::getUnqual(CGM.getBlockDescriptorType());
// struct __block_literal_generic {
// void *isa;