[cfe-commits] r151853 - in /cfe/trunk: lib/CodeGen/CGObjC.cpp test/CodeGenObjCXX/lambda-expressions.mm

Eli Friedman eli.friedman at gmail.com
Thu Mar 1 14:52:29 PST 2012


Author: efriedma
Date: Thu Mar  1 16:52:28 2012
New Revision: 151853

URL: http://llvm.org/viewvc/llvm-project?rev=151853&view=rev
Log:
Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.


Modified:
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=151853&r1=151852&r2=151853&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Mar  1 16:52:28 2012
@@ -2777,9 +2777,9 @@
 llvm::Value *
 CodeGenFunction::EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty) {
   // Get selectors for retain/autorelease.
-  IdentifierInfo *RetainID = &getContext().Idents.get("retain");
-  Selector RetainSelector =
-      getContext().Selectors.getNullarySelector(RetainID);
+  IdentifierInfo *CopyID = &getContext().Idents.get("copy");
+  Selector CopySelector =
+      getContext().Selectors.getNullarySelector(CopyID);
   IdentifierInfo *AutoreleaseID = &getContext().Idents.get("autorelease");
   Selector AutoreleaseSelector =
       getContext().Selectors.getNullarySelector(AutoreleaseID);
@@ -2789,7 +2789,7 @@
   llvm::Value *Val = Block;
   RValue Result;
   Result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(),
-                                       Ty, RetainSelector,
+                                       Ty, CopySelector,
                                        Val, CallArgList(), 0, 0);
   Val = Result.getScalarVal();
   Result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(),

Modified: cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm?rev=151853&r1=151852&r2=151853&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm Thu Mar  1 16:52:28 2012
@@ -4,6 +4,8 @@
 typedef int (^fp)();
 fp f() { auto x = []{ return 3; }; return x; }
 
+// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [5 x i8] c"copy\00"
+// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [12 x i8] c"autorelease\00"
 // MRC: define i32 ()* @_Z1fv(
 // MRC: define internal i32 ()* @"_ZZ1fvENK3$_0cvU13block_pointerFivEEv"
 // MRC: store i8* bitcast (i8** @_NSConcreteStackBlock to i8*)





More information about the cfe-commits mailing list