aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-24 03:38:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-24 03:38:44 +0000
commit49f6602707887eea1a558a1dffe0213102f887f2 (patch)
tree984d63975c2fb0f03ec00fe04bc78f21d4a1940c /lib/CodeGen/CGObjCMac.cpp
parent0fb1d15c37ed26dc24e477fd80df4b0f7872b4ed (diff)
Add Obj-C runtime methods to get runtime specific functions for
implementing property access. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 2cda9d54b5..8a10d33e41 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -131,6 +131,7 @@ public:
/// MethodListPtrTy - LLVM type for struct objc_method_list *.
const llvm::Type *MethodListPtrTy;
+ llvm::Function *GetPropertyFn, *SetPropertyFn;
llvm::Function *EnumerationMutationFn;
/// ExceptionDataTy - LLVM type for struct _objc_exception_data.
@@ -394,6 +395,8 @@ public:
virtual void GenerateProtocol(const ObjCProtocolDecl *PD);
virtual llvm::Function *ModuleInitFunction();
+ virtual llvm::Function *GetPropertyGetFunction();
+ virtual llvm::Function *GetPropertySetFunction();
virtual llvm::Function *EnumerationMutationFunction();
virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF,
@@ -1367,6 +1370,14 @@ llvm::Function *CGObjCMac::ModuleInitFunction() {
return NULL;
}
+llvm::Function *CGObjCMac::GetPropertyGetFunction() {
+ return ObjCTypes.GetPropertyFn;
+}
+
+llvm::Function *CGObjCMac::GetPropertySetFunction() {
+ return ObjCTypes.SetPropertyFn;
+}
+
llvm::Function *CGObjCMac::EnumerationMutationFunction()
{
return ObjCTypes.EnumerationMutationFn;
@@ -2087,7 +2098,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
NULL);
CGM.getModule().addTypeName("struct._objc_module", ModuleTy);
- // Message send functions
+ // Message send functions.
std::vector<const llvm::Type*> Params;
Params.push_back(ObjectPtrTy);
@@ -2134,8 +2145,37 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
"objc_msgSendSuper_stret",
&CGM.getModule());
+ // Property manipulation functions.
+
+ Params.clear();
+ Params.push_back(ObjectPtrTy);
+ Params.push_back(SelectorPtrTy);
+ Params.push_back(LongTy);
+ Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
+ GetPropertyFn =
+ llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
+ Params,
+ false),
+ llvm::Function::ExternalLinkage,
+ "objc_getProperty",
+ &CGM.getModule());
+
+ Params.clear();
+ Params.push_back(ObjectPtrTy);
+ Params.push_back(SelectorPtrTy);
+ Params.push_back(LongTy);
+ Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
+ Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
+ SetPropertyFn =
+ llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
+ Params,
+ false),
+ llvm::Function::ExternalLinkage,
+ "objc_setProperty",
+ &CGM.getModule());
+
// Enumeration mutation.
-
+
Params.clear();
Params.push_back(ObjectPtrTy);
EnumerationMutationFn =