[cfe-commits] r104296 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CodeGenObjC/objc-gc-aggr-assign.m
Fariborz Jahanian
fjahanian at apple.com
Thu May 20 16:34:56 PDT 2010
Author: fjahanian
Date: Thu May 20 18:34:56 2010
New Revision: 104296
URL: http://llvm.org/viewvc/llvm-project?rev=104296&view=rev
Log:
Generate objc_memmove_collectable write-barrier for
classes whose base class have GC'able object pointers.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CodeGenObjC/objc-gc-aggr-assign.m
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=104296&r1=104295&r2=104296&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu May 20 18:34:56 2010
@@ -622,7 +622,13 @@
QualType NewBaseType
= Context.getCanonicalType(Bases[idx]->getType());
NewBaseType = NewBaseType.getLocalUnqualifiedType();
-
+ if (!Class->hasObjectMember()) {
+ if (const RecordType *FDTTy =
+ NewBaseType.getTypePtr()->getAs<RecordType>())
+ if (FDTTy->getDecl()->hasObjectMember())
+ Class->setHasObjectMember(true);
+ }
+
if (KnownBaseTypes[NewBaseType]) {
// C++ [class.mi]p3:
// A class shall not be specified as a direct base class of a
Modified: cfe/trunk/test/CodeGenObjC/objc-gc-aggr-assign.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc-gc-aggr-assign.m?rev=104296&r1=104295&r2=104296&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc-gc-aggr-assign.m (original)
+++ cfe/trunk/test/CodeGenObjC/objc-gc-aggr-assign.m Thu May 20 18:34:56 2010
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_memmove_collectable %t | grep call | count 3
// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
-// RUN: grep objc_memmove_collectable %t | grep call | count 3
+// RUN: grep objc_memmove_collectable %t | grep call | count 4
static int count;
@@ -46,3 +46,12 @@
*out = *in;
}
+#ifdef __cplusplus
+struct Derived : type_s { };
+
+void foo(Derived* src, Derived* dest) {
+ *dest = *src;
+}
+
+#endif
+
More information about the cfe-commits
mailing list