xref: /aosp_15_r20/external/clang/test/Parser/warn-semicolon-before-method-body.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -Wsemicolon-before-method-body -verify %s
2*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -Wsemicolon-before-method-body -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3*67e74705SXin Li
4*67e74705SXin Li// Allow optional semicolon in objc method definition after method prototype,
5*67e74705SXin Li// warn about it and suggest a fixit.
6*67e74705SXin Li
7*67e74705SXin Li@interface NSObject
8*67e74705SXin Li@end
9*67e74705SXin Li
10*67e74705SXin Li@interface C : NSObject
11*67e74705SXin Li- (int)z;
12*67e74705SXin Li@end
13*67e74705SXin Li
14*67e74705SXin Li@implementation C
15*67e74705SXin Li- (int)z; // expected-warning {{semicolon before method body is ignored}}
16*67e74705SXin Li{
17*67e74705SXin Li  return 0;
18*67e74705SXin Li}
19*67e74705SXin Li@end
20*67e74705SXin Li
21*67e74705SXin Li// CHECK: fix-it:"{{.*}}":{15:9-15:10}:""
22*67e74705SXin Li
23