Patch adds test to my previous patch for assigning to
gc'able structs in the Next runtime and adds missing
PCH info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 94e46ac..308d73f 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -128,6 +128,7 @@
VisitTagDecl(RD);
RD->setHasFlexibleArrayMember(Record[Idx++]);
RD->setAnonymousStructOrUnion(Record[Idx++]);
+ RD->setHasObjectMember(Record[Idx++]);
}
void PCHDeclReader::VisitValueDecl(ValueDecl *VD) {
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index a6843e1..c588a18 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -125,6 +125,7 @@
VisitTagDecl(D);
Record.push_back(D->hasFlexibleArrayMember());
Record.push_back(D->isAnonymousStructOrUnion());
+ Record.push_back(D->hasObjectMember());
Code = pch::DECL_RECORD;
}
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
new file mode 100644
index 0000000..b6b08ff
--- /dev/null
+++ b/test/CodeGenObjC/objc-gc-aggr-assign.m
@@ -0,0 +1,42 @@
+// RUN: clang-cc -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_memmove_collectable %t | grep call | count 2
+
+static int count;
+
+typedef struct S {
+ int ii;
+} SS;
+
+struct type_s {
+ SS may_recurse;
+ id id_val;
+};
+
+@interface NamedObject
+{
+ struct type_s type_s_ivar;
+}
+- (void) setSome : (struct type_s) arg;
+- (struct type_s) getSome;
+@property(assign) struct type_s aggre_prop;
+@end
+
+@implementation NamedObject
+- (void) setSome : (struct type_s) arg
+ {
+ type_s_ivar = arg;
+ }
+- (struct type_s) getSome
+ {
+ return type_s_ivar;
+ }
+@synthesize aggre_prop = type_s_ivar;
+@end
+
+struct type_s some = {{1234}, (id)0};
+
+struct type_s get(void)
+{
+ return some;
+}
+