aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-21 18:52:19 +0000
committerChris Lattner <sabre@nondot.org>2009-01-21 18:52:19 +0000
commit2fe9e9a4909c03a4316adb5bd16bcc4c13cac632 (patch)
tree9896c3586a6b2ca6c24c2ca0d291ff9799f3975d /lib/CodeGen
parentab95c3959fbdcaab80b1df3b96a7c16e896b24b9 (diff)
Fix objc type conversion issues with the GNU runtime, patch by
David Chisnall git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 2621a84914..9c83b75b2a 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -40,8 +40,8 @@ class CGObjCGNU : public CodeGen::CGObjCRuntime {
private:
CodeGen::CodeGenModule &CGM;
llvm::Module &TheModule;
- const llvm::StructType *SelStructTy;
- const llvm::Type *SelectorTy;
+ const llvm::PointerType *SelectorTy;
+ const llvm::Type *ExpectedSelTy;
const llvm::Type *PtrToInt8Ty;
const llvm::Type *IMPTy;
const llvm::Type *IdTy;
@@ -168,11 +168,12 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm)
PtrToInt8Ty =
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
// Get the selector Type.
- SelStructTy = llvm::StructType::get(
- PtrToInt8Ty,
- PtrToInt8Ty,
- NULL);
- SelectorTy = llvm::PointerType::getUnqual(SelStructTy);
+ SelectorTy = cast<llvm::PointerType>(
+ CGM.getTypes().ConvertType(CGM.getContext().getObjCSelType()));
+
+ ExpectedSelTy =
+ CGM.getTypes().ConvertType(CGM.getContext().getObjCSelType());
+
PtrToIntTy = llvm::PointerType::getUnqual(IntTy);
PtrTy = PtrToInt8Ty;
@@ -797,6 +798,9 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
UntypedSelectors.empty())
return NULL;
+ const llvm::StructType *SelStructTy =
+ cast<llvm::StructType>(SelectorTy->getTypeAtIndex(0U));
+
// Name the ObjC types to make the IR a bit easier to read
TheModule.addTypeName(".objc_selector", SelectorTy);
TheModule.addTypeName(".objc_id", IdTy);