[clang] dd7233b - [Analyzer] Remove extra space from NSErrorChecker message.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Wed May 18 14:35:23 PDT 2022
Author: Usama Hameed
Date: 2022-05-18T14:35:12-07:00
New Revision: dd7233bc67e45106c4625df7d20391798f31d4a7
URL: https://github.com/llvm/llvm-project/commit/dd7233bc67e45106c4625df7d20391798f31d4a7
DIFF: https://github.com/llvm/llvm-project/commit/dd7233bc67e45106c4625df7d20391798f31d4a7.diff
LOG: [Analyzer] Remove extra space from NSErrorChecker message.
Differential Revision: https://reviews.llvm.org/D125840
Added:
Modified:
clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
clang/test/Analysis/CheckNSError.m
clang/test/Analysis/incorrect-checker-names.mm
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
index 79b4f40417264..33242b827bacd 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -266,7 +266,7 @@ void NSOrCFErrorDerefChecker::checkEvent(ImplicitNullDerefEvent event) const {
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");
diff --git a/clang/test/Analysis/CheckNSError.m b/clang/test/Analysis/CheckNSError.m
index 510f11c055795..47a6b432cbe0c 100644
--- a/clang/test/Analysis/CheckNSError.m
+++ b/clang/test/Analysis/CheckNSError.m
@@ -27,7 +27,7 @@ - (BOOL)myMethodWhichMayFail4:(NSError **)error __attribute__((nonnull));
@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 @@ - (BOOL)myMethodWhichMayFail4:(NSError **)error { // no-warning
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)) f4(CFErrorRef *error) {
}
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;
}
diff --git a/clang/test/Analysis/incorrect-checker-names.mm b/clang/test/Analysis/incorrect-checker-names.mm
index bf7c6c071153a..12cab9be1df18 100644
--- a/clang/test/Analysis/incorrect-checker-names.mm
+++ b/clang/test/Analysis/incorrect-checker-names.mm
@@ -107,7 +107,7 @@ + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictio
void foo(CFErrorRef* error) { // expected-warning{{Function accepting CFErrorRef* should have a non-void return value to indicate whether or not an error occurred [osx.coreFoundation.CFError]}}
// FIXME: This shouldn't be tied to a modeling checker.
- *error = 0; // expected-warning {{Potential null dereference. According to coding standards documented in CoreFoundation/CFError.h the parameter may be null [osx.coreFoundation.CFError]}}
+ *error = 0; // expected-warning {{Potential null dereference. According to coding standards documented in CoreFoundation/CFError.h the parameter may be null [osx.coreFoundation.CFError]}}
}
@interface A
@@ -116,7 +116,7 @@ - (void)myMethodWhichMayFail:(NSError **)error;
@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 [osx.cocoa.NSError]}}
- *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]}}
+ *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]}}
}
@end
More information about the cfe-commits
mailing list