xref: /llvm-project/clang/test/SemaObjC/objc-string-constant.m (revision 8fbe78f6fc7b41d1a4228c126fcb522131150518)
1*8fbe78f6SDaniel Dunbar// RUN: %clang_cc1 -Wsemicolon-before-method-body %s -verify -fsyntax-only
254e59452SSteve Naroff
354e59452SSteve Naroff#define nil 0       /* id of Nil instance */
454e59452SSteve Naroff
554e59452SSteve Naroff@interface NSObject
654e59452SSteve Naroff@end
754e59452SSteve Naroff
854e59452SSteve Naroff@interface NSString : NSObject
954e59452SSteve Naroff
1054e59452SSteve Naroff@end
1154e59452SSteve Naroff
1254e59452SSteve Naroff@interface NSMutableString : NSString
1354e59452SSteve Naroff
1454e59452SSteve Naroff@end
1554e59452SSteve Naroff
1654e59452SSteve Naroff@interface NSSimpleCString : NSString {
1754e59452SSteve Naroff@protected
1854e59452SSteve Naroff    char *bytes;
1954e59452SSteve Naroff    int numBytes;
2054e59452SSteve Naroff}
2154e59452SSteve Naroff@end
2254e59452SSteve Naroff
2354e59452SSteve Naroff@interface NSConstantString : NSSimpleCString
2454e59452SSteve Naroff@end
2554e59452SSteve Naroff
2654e59452SSteve Naroff
2754e59452SSteve Naroff@interface Subclass : NSObject
2854e59452SSteve Naroff- (NSString *)token;
2954e59452SSteve Naroff@end
3054e59452SSteve Naroff
3154e59452SSteve Naroff@implementation Subclass
32b14d7041SFariborz Jahanian- (NSString *)token;	// expected-warning {{semicolon before method body is ignored}}
3354e59452SSteve Naroff{
3454e59452SSteve Naroff  NSMutableString *result = nil;
3554e59452SSteve Naroff
3654e59452SSteve Naroff  return (result != nil) ? result : @"";
3754e59452SSteve Naroff}
3854e59452SSteve Naroff@end
3954e59452SSteve Naroff
40