brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · fa127f0 Raw
120 lines · plain
1// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp2// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp3 4// -Did="void*" -DSEL="void *" -DClass="void*"5@interface NSMutableArray {6  id isa;7}8@end9 10typedef unsigned char BOOL;11typedef unsigned long NSUInteger;12 13__attribute__((visibility("hidden")))14@interface __NSArrayM : NSMutableArray {15    NSUInteger _used;16    NSUInteger _doHardRetain:1;17    NSUInteger _doWeakAccess:1;18#if __LP64__19    NSUInteger _size:62;20#else21    NSUInteger _size:30;22#endif23    NSUInteger _hasObjects:1;24    NSUInteger _hasStrongReferences:1;25#if __LP64__26    NSUInteger _offset:62;27#else28    NSUInteger _offset:30;29#endif30    unsigned long _mutations;31    id *_list;32}33@end34 35 36id __CFAllocateObject2();37BOOL objc_collectingEnabled();38 39@implementation __NSArrayM40+ (id)__new:(const id [])objects :(NSUInteger)count :(BOOL)hasObjects :(BOOL)hasStrong :(BOOL)transferRetain {41    __NSArrayM *newArray = (__NSArrayM *)__CFAllocateObject2();42    newArray->_size = count;43    newArray->_mutations = 1;44    newArray->_doHardRetain = (hasObjects && hasStrong);45    newArray->_doWeakAccess = (objc_collectingEnabled() && !hasStrong);46    newArray->_hasObjects = hasObjects;47    newArray->_hasStrongReferences = hasStrong;48    newArray->_list = 0;49    return *newArray->_list;50}51@end52 53// Test254@interface Super {55  int ivar_super_a : 5;56}57@end58 59@interface A : Super {60@public61  int ivar_a : 5;62}63@end64 65int f0(A *a) {66  return a->ivar_a;67}68 69@interface A () {70@public71  int ivar_ext_a : 5;72  int ivar_ext_b : 5;73}@end74 75int f1(A *a) {76  return a->ivar_ext_a + a->ivar_a;77}78 79@interface A () {80@public81  int ivar_ext2_a : 5;82  int ivar_ext2_b : 5;83}@end84 85int f2(A* a) {86  return a->ivar_ext2_a + a->ivar_ext_a + a->ivar_a;87}88 89@implementation A {90@public91  int ivar_b : 5;92  int ivar_c : 5;93  int ivar_d : 5;94}95@end96 97int f3(A *a) {  98  return a->ivar_d + a->ivar_ext2_a + a->ivar_ext_a + a->ivar_a;99}100 101__attribute__((objc_root_class)) @interface Base102{103    struct objc_class *isa;104    int full;105    int full2: 32;106    int _refs: 8;107    int field2: 3;108    unsigned f3: 8;109    short cc;110    unsigned g: 16;111    int r2: 8;112    int r3: 8;113    int r4: 2;114    int r5: 8;115    char c;116}117@end118 119@implementation Base @end120