[cfe-commits] r61044 - /cfe/trunk/test/CodeGenObjC/bitfield-1.m
Fariborz Jahanian
fjahanian at apple.com
Mon Dec 15 12:39:59 PST 2008
Author: fjahanian
Date: Mon Dec 15 14:39:58 2008
New Revision: 61044
URL: http://llvm.org/viewvc/llvm-project?rev=61044&view=rev
Log:
And a test case for my previous patch.
Added:
cfe/trunk/test/CodeGenObjC/bitfield-1.m
Added: cfe/trunk/test/CodeGenObjC/bitfield-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/bitfield-1.m?rev=61044&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/bitfield-1.m (added)
+++ cfe/trunk/test/CodeGenObjC/bitfield-1.m Mon Dec 15 14:39:58 2008
@@ -0,0 +1,79 @@
+// RUN: clang -emit-llvm -o %t %s
+
+ at interface Object
+- (id) alloc;
+- (id) init;
+ at end
+
+extern void abort(void);
+
+#define CHECK_IF(expr) if(!(expr)) abort();
+
+ at interface Base: Object
+{
+ int full;
+ int full2: 32;
+ int _refs: 8;
+ int field2: 3;
+ unsigned f3: 8;
+ short cc;
+ unsigned g: 16;
+ int r2: 8;
+ int r3: 8;
+ int r4: 2;
+ int r5: 8;
+ char c;
+}
+- (void)setValues;
+ at end
+
+ at interface Derived: Base
+{
+ char d;
+ int _field3: 6;
+}
+- (void)checkValues;
+ at end
+
+ at implementation Base
+-(void)setValues {
+ full = 1;
+ full2 = 2;
+ _refs = 3;
+ field2 = 1;
+ f3 = 6;
+ cc = 7;
+ g = 8;
+ r2 = 9;
+ r3 = 10;
+ r4 = 1;
+ r5 = 12;
+ c = 13;
+}
+ at end
+
+ at implementation Derived
+-(void)checkValues {
+ CHECK_IF(full == 1);
+ CHECK_IF(full2 == 2);
+ CHECK_IF(_refs == 3);
+ CHECK_IF(field2 == 1);
+ CHECK_IF(f3 == 6);
+ CHECK_IF(cc == 7);
+ CHECK_IF(g == 8);
+ CHECK_IF(r2 == 9);
+ CHECK_IF(r3 == 10);
+ CHECK_IF(r4 == 1);
+ CHECK_IF(r5 == 12);
+ CHECK_IF(c == 13);
+}
+ at end
+
+int main(void) {
+ Derived *obj = [[Derived alloc] init];
+
+ [obj setValues];
+ [obj checkValues];
+
+ return 0;
+}
More information about the cfe-commits
mailing list