Skip to content

Commit d2658ca

Browse files
committed
[clang][objc] Fix test for protocol stub fixits
This test has been silently broken for a while due to using -serialize-diagnostics-file, which interferes with -verify (the verify consumer runs, but does not cause the compilation to fail). Fix the checks and use -fallow-editor-placeholders instead to enable the correct diagnostic mode. (cherry picked from commit 8ffa4d4)
1 parent 77f8041 commit d2658ca

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

clang/test/FixIt/fixit-fill-in-protocol-requirements.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -verify -Wno-objc-root-class -serialize-diagnostic-file /dev/null %s
2-
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -fdiagnostics-parseable-fixits -serialize-diagnostic-file /dev/null %s 2>&1 | FileCheck %s
3-
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.12 -fdiagnostics-parseable-fixits -serialize-diagnostic-file /dev/null %s 2>&1 | FileCheck --check-prefix=AVAILABLE %s
1+
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -verify -Wno-objc-root-class -fallow-editor-placeholders %s
2+
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -fdiagnostics-parseable-fixits -fallow-editor-placeholders %s 2>&1 | FileCheck %s
3+
// RUN: %clang_cc1 -triple=x86_64-apple-macos10.12 -fdiagnostics-parseable-fixits -fallow-editor-placeholders %s 2>&1 | FileCheck --check-prefix=AVAILABLE %s
44

55
@protocol P1
66

@@ -18,7 +18,7 @@ @interface I <P2>
1818

1919
@end
2020

21-
@implementation I // expected-warning {{warning: class 'I' does not conform to protocols 'P2' and 'P1'}} expected-note {{add stubs for missing protocol requirements}}
21+
@implementation I // expected-warning {{class 'I' does not conform to protocols 'P2' and 'P1'}} expected-note {{add stubs for missing protocol requirements}}
2222

2323
@end
2424
// CHECK: fix-it:{{.*}}:{[[@LINE-1]]:1-[[@LINE-1]]:1}:"- (void)p2Method { \n <#code#>\n}\n\n- (void)p1Method { \n <#code#>\n}\n\n"
@@ -29,11 +29,11 @@ + (void)p3ClassMethod;
2929

3030
@end
3131

32-
@interface I (Category) <P3> // expected-warning {{warning: category 'Category' does not conform to protocols 'P3'}} expected-note {{add stubs for missing protocol requirements}}
32+
@interface I (Category) <P3>
3333

3434
@end
3535

36-
@implementation I (Category)
36+
@implementation I (Category) // expected-warning {{category 'Category' does not conform to protocol 'P3'}} expected-note {{add stubs for missing protocol requirements}}
3737

3838
@end
3939
// CHECK: fix-it:{{.*}}:{[[@LINE-1]]:1-[[@LINE-1]]:1}:"+ (void)p3ClassMethod { \n <#code#>\n}\n\n"
@@ -44,14 +44,14 @@ - (void)anotherMethod;
4444

4545
@end
4646

47-
@interface ThreeProtocols <P2, P1, P3> // expected-warning {{class 'ThreeProtocols' does not conform to protocols 'P2', 'P1' and 'P3'}} expected-note {{add stubs for missing protocol requirements}}
47+
@interface ThreeProtocols <P2, P1, P3>
4848
@end
49-
@implementation ThreeProtocols
49+
@implementation ThreeProtocols // expected-warning {{class 'ThreeProtocols' does not conform to protocols 'P2', 'P1' and 'P3'}} expected-note {{add stubs for missing protocol requirements}}
5050
@end
5151

52-
@interface FourProtocols <P2, P3, P4> // expected-warning {{class 'ThreeProtocols' does not conform to protocols 'P2', 'P1', 'P3', ...}} expected-note {{add stubs for missing protocol requirements}}
52+
@interface FourProtocols <P2, P3, P4>
5353
@end
54-
@implementation FourProtocols
54+
@implementation FourProtocols // expected-warning {{class 'FourProtocols' does not conform to protocols 'P2', 'P1', 'P3', ...}} expected-note {{add stubs for missing protocol requirements}}
5555
@end
5656

5757
// Unavailable methods
@@ -67,7 +67,7 @@ - (void)deprecatedMethod __attribute__((availability(macos,introduced=10.0, depr
6767
@interface ImplementsAllAvailable <TakeAvailabilityIntoAccount>
6868
@end
6969

70-
@implementation ImplementsAllAvailable // No warning!
70+
@implementation ImplementsAllAvailable // expected-warning {{class 'ImplementsAllAvailable' does not conform to protocol 'TakeAvailabilityIntoAccount'}} expected-note {{add stubs for missing protocol requirements}}
7171

7272
- (void)availableMethod { }
7373
- (void)deprecatedMethod { }

0 commit comments

Comments
 (0)