[cfe-commits] r119411 - in /cfe/trunk/lib: AST/ASTContext.cpp CodeGen/CGBlocks.cpp CodeGen/CGDecl.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Nov 16 16:21:28 PST 2010


Author: fjahanian
Date: Tue Nov 16 18:21:28 2010
New Revision: 119411

URL: http://llvm.org/viewvc/llvm-project?rev=119411&view=rev
Log:
Fixes synthesis of type for the object which holds info.
about a __block cxx object.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=119411&r1=119410&r2=119411&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Nov 16 18:21:28 2010
@@ -3282,6 +3282,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/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=119411&r1=119410&r2=119411&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue Nov 16 18:21:28 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/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=119411&r1=119410&r2=119411&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Nov 16 18:21:28 2010
@@ -659,7 +659,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 cfe-commits mailing list