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
13

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

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