diff options
Diffstat (limited to 'gcc/testsuite/objc.dg/const-str-10.m')
-rw-r--r-- | gcc/testsuite/objc.dg/const-str-10.m | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/const-str-10.m b/gcc/testsuite/objc.dg/const-str-10.m new file mode 100644 index 00000000000..6e6d86a8860 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-10.m @@ -0,0 +1,29 @@ +/* APPLE LOCAL file 4149909 */ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fno-constant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSString: Object +@end + +@interface NSSimpleCString : NSString { +@protected + char *bytes; + unsigned int numBytes; +} +@end + +@interface NSConstantString : NSSimpleCString +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ |