[cfe-commits] r110377 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/block-var-layout.m
Fariborz Jahanian
fjahanian at apple.com
Thu Aug 5 14:00:25 PDT 2010
Author: fjahanian
Date: Thu Aug 5 16:00:25 2010
New Revision: 110377
URL: http://llvm.org/viewvc/llvm-project?rev=110377&view=rev
Log:
Add support for block imported struct variable layout info.
(objc gc and blocks in NeXt runtime).
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/block-var-layout.m
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=110377&r1=110376&r2=110377&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Aug 5 16:00:25 2010
@@ -1727,10 +1727,18 @@
QualType Ty = VD->getType();
assert(!Ty->isArrayType() &&
"Array block variable should have been caught");
+ if (Ty->isRecordType() && !BDRE->isByRef()) {
+ bool HasUnion = false;
+ BuildAggrIvarRecordLayout(Ty->getAs<RecordType>(),
+ FieldOffset,
+ true,
+ HasUnion);
+ continue;
+ }
// FIXME. Handle none __block Aggregate variables
#if 0
- if ((Ty->isRecordType() || Ty->isUnionType()) && !BDRE->isByRef())
- assert(false && "Aggregate block variable layout NYI");
+ if (Ty->isUnionType() && !BDRE->isByRef())
+ assert(false && "union block variable layout NYI");
#endif
Qualifiers::GC GCAttr = GetGCAttrTypeForType(CGM.getContext(), Ty);
unsigned FieldSize = CGM.getContext().getTypeSize(Ty);
Modified: cfe/trunk/test/CodeGenObjC/block-var-layout.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/block-var-layout.m?rev=110377&r1=110376&r2=110377&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/block-var-layout.m (original)
+++ cfe/trunk/test/CodeGenObjC/block-var-layout.m Thu Aug 5 16:00:25 2010
@@ -3,6 +3,17 @@
// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
+struct S {
+ int i1;
+ id o1;
+ struct V {
+ int i2;
+ id o2;
+ } v1;
+ int i3;
+ id o3;
+};
+
__weak id wid;
void x(id y) {}
void y(int a) {}
@@ -52,6 +63,13 @@
x(byref_bab);
};
d();
+
+// Test4
+ struct S s2;
+ void (^e)() = ^{
+ x(s2.o1);
+ };
+ e();
}
// CHECK-LP64: L_OBJC_CLASS_NAME_:
@@ -63,3 +81,5 @@
// CHECK-LP64: L_OBJC_CLASS_NAME_6:
// CHECK-LP64-NEXT: .asciz "A\023!"
+// CHECK-LP64: L_OBJC_CLASS_NAME_11:
+// CHECK-LP64-NEXT: .asciz "Q\021\021"
More information about the cfe-commits
mailing list