[llvm-branch-commits] [cfe-branch] r121546 - in /cfe/branches/Apple/whitney/lib: AST/ASTContext.cpp CodeGen/CGBlocks.cpp CodeGen/CGDecl.cpp

Daniel Dunbar daniel at zuster.org
Fri Dec 10 13:37:19 PST 2010


Author: ddunbar
Date: Fri Dec 10 15:37:19 2010
New Revision: 121546

URL: http://llvm.org/viewvc/llvm-project?rev=121546&view=rev
Log:
Merge r119411:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date:   Wed Nov 17 00:21:28 2010 +0000

    Fixes synthesis of type for the object which holds info.
    about a __block cxx object.

Modified:
    cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp
    cfe/branches/Apple/whitney/lib/CodeGen/CGBlocks.cpp
    cfe/branches/Apple/whitney/lib/CodeGen/CGDecl.cpp

Modified: cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp?rev=121546&r1=121545&r2=121546&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp Fri Dec 10 15:37:19 2010
@@ -3284,6 +3284,13 @@
     return true;
   if (Ty->isObjCObjectPointerType())
     return true;
+  if (getLangOptions().CPlusPlus) {
+    if (const RecordType *RT = Ty->getAs<RecordType>()) {
+      CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
+      return RD->hasConstCopyConstructor(*this);
+      
+    }
+  }
   return false;
 }
 

Modified: cfe/branches/Apple/whitney/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/CodeGen/CGBlocks.cpp?rev=121546&r1=121545&r2=121546&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/branches/Apple/whitney/lib/CodeGen/CGBlocks.cpp Fri Dec 10 15:37:19 2010
@@ -1016,9 +1016,8 @@
             Srcv = Builder.CreateBitCast(Srcv, PtrStructTy);
             Srcv = Builder.CreateStructGEP(Srcv, CGF.getByRefValueLLVMField(VD),
                                         VD->getNameAsString());
-            Dstv = Builder.CreateStructGEP(DstObj, index);
-            Dstv = Builder.CreateLoad(Dstv);
-            Dstv = Builder.CreateBitCast(Dstv, PtrStructTy);
+
+            Dstv = Builder.CreateBitCast(DstObj, PtrStructTy);
             Dstv = Builder.CreateStructGEP(Dstv, CGF.getByRefValueLLVMField(VD),
                                            VD->getNameAsString());
             CGF.EmitSynthesizedCXXCopyCtor(Dstv, Srcv, 

Modified: cfe/branches/Apple/whitney/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/CodeGen/CGDecl.cpp?rev=121546&r1=121545&r2=121546&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/branches/Apple/whitney/lib/CodeGen/CGDecl.cpp Fri Dec 10 15:37:19 2010
@@ -669,7 +669,8 @@
     if (Ty->isBlockPointerType()) {
       flag |= BLOCK_FIELD_IS_BLOCK;
       flags |= BLOCK_HAS_COPY_DISPOSE;
-    } else if (BlockRequiresCopying(Ty)) {
+    } else if (getContext().isObjCNSObjectType(Ty) || 
+               Ty->isObjCObjectPointerType()) {
       flag |= BLOCK_FIELD_IS_OBJECT;
       flags |= BLOCK_HAS_COPY_DISPOSE;
     }





More information about the llvm-branch-commits mailing list