]> granicus.if.org Git - clang/commitdiff
Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 1 Mar 2012 22:52:28 +0000 (22:52 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 1 Mar 2012 22:52:28 +0000 (22:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151853 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjC.cpp
test/CodeGenObjCXX/lambda-expressions.mm

index 9eb58fc603c6a592e556bfe0439821bdaf6e991c..6d95f17226e5b5ba41db4f2841329bf9f8673ec3 100644 (file)
@@ -2777,9 +2777,9 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
 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 @@ CodeGenFunction::EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty) {
   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(),
index 36a1996ee87d1dd1f568eea5c05589d1e632f581..858cb74aa2a5c555556c7870993a2a60a69f7433 100644 (file)
@@ -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*)