usama54321 created this revision.
Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, dkrupp,
donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware,
xazax.hun.
Herald added a project: All.
usama54321 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125840
Files:
clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
clang/test/Analysis/CheckNSError.m
Index: clang/test/Analysis/CheckNSError.m
===================================================================
--- clang/test/Analysis/CheckNSError.m
+++ clang/test/Analysis/CheckNSError.m
@@ -27,7 +27,7 @@
@implementation A
- (void)myMethodWhichMayFail:(NSError **)error { // expected-warning
{{Method accepting NSError** should have a non-void return value to indicate
whether or not an error occurred}}
- *error = [NSError errorWithDomain:@"domain" code:1 userInfo:0]; //
expected-warning {{Potential null dereference}}
+ *error = [NSError errorWithDomain:@"domain" code:1 userInfo:0]; //
expected-warning {{Potential null dereference. According to coding standards in
'Creating and Returning NSError Objects' the parameter may be null
[osx.cocoa.NSError]}}
}
- (BOOL)myMethodWhichMayFail2:(NSError **)error { // no-warning
@@ -50,7 +50,7 @@
typedef struct __CFError* CFErrorRef;
void foo(CFErrorRef* error) { // expected-warning {{Function accepting
CFErrorRef* should have a non-void return value to indicate whether or not an
error occurred}}
- *error = 0; // expected-warning {{Potential null dereference}}
+ *error = 0; // expected-warning {{Potential null dereference. According to
coding standards documented in CoreFoundation/CFError.h the parameter may be
null [osx.coreFoundation.CFError]}}
}
int f1(CFErrorRef* error) {
@@ -74,7 +74,7 @@
}
int __attribute__((nonnull(1))) f5(int *x, CFErrorRef *error) {
- *error = 0; // expected-warning {{Potential null dereference}}
+ *error = 0; // expected-warning {{Potential null dereference. According to
coding standards documented in CoreFoundation/CFError.h the parameter may be
null [osx.coreFoundation.CFError]}}
return 0;
}
Index: clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -266,7 +266,7 @@
SmallString<128> Buf;
llvm::raw_svector_ostream os(Buf);
- os << "Potential null dereference. According to coding standards ";
+ os << "Potential null dereference. According to coding standards ";
os << (isNSError
? "in 'Creating and Returning NSError Objects' the parameter"
: "documented in CoreFoundation/CFError.h the parameter");
Index: clang/test/Analysis/CheckNSError.m
===================================================================
--- clang/test/Analysis/CheckNSError.m
+++ clang/test/Analysis/CheckNSError.m
@@ -27,7 +27,7 @@
@implementation A
- (void)myMethodWhichMayFail:(NSError **)error { // expected-warning {{Method accepting NSError** should have a non-void return value to indicate whether or not an error occurred}}
- *error = [NSError errorWithDomain:@"domain" code:1 userInfo:0]; // expected-warning {{Potential null dereference}}
+ *error = [NSError errorWithDomain:@"domain" code:1 userInfo:0]; // expected-warning {{Potential null dereference. According to coding standards in 'Creating and Returning NSError Objects' the parameter may be null [osx.cocoa.NSError]}}
}
- (BOOL)myMethodWhichMayFail2:(NSError **)error { // no-warning
@@ -50,7 +50,7 @@
typedef struct __CFError* CFErrorRef;
void foo(CFErrorRef* error) { // expected-warning {{Function accepting CFErrorRef* should have a non-void return value to indicate whether or not an error occurred}}
- *error = 0; // expected-warning {{Potential null dereference}}
+ *error = 0; // expected-warning {{Potential null dereference. According to coding standards documented in CoreFoundation/CFError.h the parameter may be null [osx.coreFoundation.CFError]}}
}
int f1(CFErrorRef* error) {
@@ -74,7 +74,7 @@
}
int __attribute__((nonnull(1))) f5(int *x, CFErrorRef *error) {
- *error = 0; // expected-warning {{Potential null dereference}}
+ *error = 0; // expected-warning {{Potential null dereference. According to coding standards documented in CoreFoundation/CFError.h the parameter may be null [osx.coreFoundation.CFError]}}
return 0;
}
Index: clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -266,7 +266,7 @@
SmallString<128> Buf;
llvm::raw_svector_ostream os(Buf);
- os << "Potential null dereference. According to coding standards ";
+ os << "Potential null dereference. According to coding standards ";
os << (isNSError
? "in 'Creating and Returning NSError Objects' the parameter"
: "documented in CoreFoundation/CFError.h the parameter");
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits