]> granicus.if.org Git - clang/commitdiff
Add some API code for future work.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Apr 2010 18:18:10 +0000 (18:18 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Apr 2010 18:18:10 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101052 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CGObjCRuntime.h

index d4452000dc042016ff7db5ff700609e00a1cbe77..99cce647db9faac001f811b2fc81c5eb16cccb9d 100644 (file)
@@ -170,6 +170,7 @@ public:
   virtual llvm::Function *ModuleInitFunction();
   virtual llvm::Function *GetPropertyGetFunction();
   virtual llvm::Function *GetPropertySetFunction();
+  virtual llvm::Function *GetCopyStructFunction();
   virtual llvm::Constant *EnumerationMutationFunction();
 
   virtual void EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
@@ -1686,6 +1687,11 @@ llvm::Function *CGObjCGNU::GetPropertySetFunction() {
                                                         "objc_setProperty"));
 }
 
+// FIXME. Implement this.
+llvm::Function *CGObjCGNU::GetCopyStructFunction() {
+  return 0;
+}
+
 llvm::Constant *CGObjCGNU::EnumerationMutationFunction() {
   CodeGen::CodeGenTypes &Types = CGM.getTypes();
   ASTContext &Ctx = CGM.getContext();
index be17e59d972ef7a01027dd569ecb92dbaa27a16c..4713ac7ca27346a15562def093a9387fe07ffd3a 100644 (file)
@@ -329,6 +329,24 @@ public:
     return CGM.CreateRuntimeFunction(FTy, "objc_setProperty");
   }
 
+  
+  llvm::Constant *getCopyStructFn() {
+    CodeGen::CodeGenTypes &Types = CGM.getTypes();
+    ASTContext &Ctx = CGM.getContext();
+    // void objc_copyStruct (void *, const void *, size_t, bool, bool)
+    llvm::SmallVector<CanQualType,5> Params;
+    Params.push_back(Ctx.VoidPtrTy);
+    Params.push_back(Ctx.VoidPtrTy);
+    Params.push_back(Ctx.LongTy);
+    Params.push_back(Ctx.BoolTy);
+    Params.push_back(Ctx.BoolTy);
+    const llvm::FunctionType *FTy =
+      Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params,
+                                                  FunctionType::ExtInfo()),
+                            false);
+    return CGM.CreateRuntimeFunction(FTy, "objc_copyStruct");
+  }
+  
   llvm::Constant *getEnumerationMutationFn() {
     CodeGen::CodeGenTypes &Types = CGM.getTypes();
     ASTContext &Ctx = CGM.getContext();
@@ -1134,6 +1152,7 @@ public:
 
   virtual llvm::Constant *GetPropertyGetFunction();
   virtual llvm::Constant *GetPropertySetFunction();
+  virtual llvm::Constant *GetCopyStructFunction();
   virtual llvm::Constant *EnumerationMutationFunction();
 
   virtual void EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
@@ -1366,6 +1385,11 @@ public:
   virtual llvm::Constant *GetPropertySetFunction() {
     return ObjCTypes.getSetPropertyFn();
   }
+  
+  virtual llvm::Constant *GetCopyStructFunction() {
+    return ObjCTypes.getCopyStructFn();
+  }
+  
   virtual llvm::Constant *EnumerationMutationFunction() {
     return ObjCTypes.getEnumerationMutationFn();
   }
@@ -2430,6 +2454,10 @@ llvm::Constant *CGObjCMac::GetPropertySetFunction() {
   return ObjCTypes.getSetPropertyFn();
 }
 
+llvm::Constant *CGObjCMac::GetCopyStructFunction() {
+  return ObjCTypes.getCopyStructFn();
+}
+
 llvm::Constant *CGObjCMac::EnumerationMutationFunction() {
   return ObjCTypes.getEnumerationMutationFn();
 }
index e478394fb1aae792964e6d3e18180c7950ce8720..64e68083c0b04a3da35fcd588ab67eb447385c07 100644 (file)
@@ -167,6 +167,9 @@ public:
   /// Return the runtime function for setting properties.
   virtual llvm::Constant *GetPropertySetFunction() = 0;
 
+  // API for atomic copying of qualified aggregates in setter/getter.
+  virtual llvm::Constant *GetCopyStructFunction() = 0;
+  
   /// GetClass - Return a reference to the class for the given
   /// interface decl.
   virtual llvm::Value *GetClass(CGBuilderTy &Builder,