Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/objc/avoid-nserror-init.m

raw
1 // RUN: %check_clang_tidy %s objc-avoid-nserror-init %t
2 @interface NSError
3 + (instancetype)alloc;
4 - (instancetype)init;
5 @end
6
7 @implementation foo
8 - (void)bar {
9 NSError *error = [[NSError alloc] init];
10 // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: use errorWithDomain:code:userInfo: or initWithDomain:code:userInfo: to create a new NSError [objc-avoid-nserror-init]
11 }
12 @end