diff options
author | Richard Trieu <rtrieu@google.com> | 2011-12-15 00:38:15 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-12-15 00:38:15 +0000 |
commit | 2fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fc (patch) | |
tree | 29e2aab8ed6d3dda663e31e3ed5434a0d3e26163 | |
parent | 60ef308e51c71b760d7f598c1b763ceb7b768148 (diff) |
Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:
// expect-error{{candidate function has different number of parameters}}
will match the following error messages from Clang:
candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters
It will also match these other error messages:
candidate function
function has different number of parameters
number of parameters
This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:
87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
106 files changed, 313 insertions, 264 deletions
diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp index cf35c8edc3..5eeb696582 100644 --- a/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -119,8 +119,7 @@ public: } virtual bool Match(const std::string &S) { - return S.find(Text) != std::string::npos || - Text.find(S) != std::string::npos; + return S.find(Text) != std::string::npos; } }; diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m index 2900b9a1fe..ba4efd3f5a 100644 --- a/test/ARCMT/nonobjc-to-objc-cast-2.m +++ b/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -20,7 +20,7 @@ void f(BOOL b) { void f2(NSString *s) { CFStringRef ref; ref = [(CFStringRef)[s string] retain]; // expected-error {{cast of Objective-C pointer type 'id' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \ - // expected-error {{ bad receiver type 'CFStringRef' (aka 'const struct __CFString *')}} \ + // expected-error {{bad receiver type 'CFStringRef' (aka 'const struct __CFString *')}} \ // expected-note{{use __bridge to convert directly (no change in ownership)}} \ // expected-note{{use __bridge_retained to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} } diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index 69b99f052b..4884bb9ea8 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -42,7 +42,7 @@ CFAbsoluteTime f1_use_after_release() { [NSMakeCollectable(date) release]; CFDateGetAbsoluteTime(date); // no-warning CFRelease(date); - t = CFDateGetAbsoluteTime(date); // expected-warning{{Reference-counted object is used after it is released.}} + t = CFDateGetAbsoluteTime(date); // expected-warning{{Reference-counted object is used after it is released}} return t; } @@ -55,7 +55,7 @@ CFAbsoluteTime f2_use_after_release() { [(id) CFMakeCollectable(date) release]; CFDateGetAbsoluteTime(date); // no-warning CFRelease(date); - t = CFDateGetAbsoluteTime(date); // expected-warning{{Reference-counted object is used after it is released.}} + t = CFDateGetAbsoluteTime(date); // expected-warning{{Reference-counted object is used after it is released}} return t; } diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m index 48450daa01..4add37b975 100644 --- a/test/Analysis/NSString.m +++ b/test/Analysis/NSString.m @@ -97,31 +97,31 @@ extern void *_NSConstantStringClassReference; NSComparisonResult f1(NSString* s) { NSString *aString = 0; - return [s compare:aString]; // expected-warning {{Argument to 'NSString' method 'compare:' cannot be nil.}} + return [s compare:aString]; // expected-warning {{Argument to 'NSString' method 'compare:' cannot be nil}} } NSComparisonResult f2(NSString* s) { NSString *aString = 0; - return [s caseInsensitiveCompare:aString]; // expected-warning {{Argument to 'NSString' method 'caseInsensitiveCompare:' cannot be nil.}} + return [s caseInsensitiveCompare:aString]; // expected-warning {{Argument to 'NSString' method 'caseInsensitiveCompare:' cannot be nil}} } NSComparisonResult f3(NSString* s, NSStringCompareOptions op) { NSString *aString = 0; - return [s compare:aString options:op]; // expected-warning {{Argument to 'NSString' method 'compare:options:' cannot be nil.}} + return [s compare:aString options:op]; // expected-warning {{Argument to 'NSString' method 'compare:options:' cannot be nil}} } NSComparisonResult f4(NSString* s, NSStringCompareOptions op, NSRange R) { NSString *aString = 0; - return [s compare:aString options:op range:R]; // expected-warning {{Argument to 'NSString' method 'compare:options:range:' cannot be nil.}} + return [s compare:aString options:op range:R]; // expected-warning {{Argument to 'NSString' method 'compare:options:range:' cannot be nil}} } NSComparisonResult f5(NSString* s, NSStringCompareOptions op, NSRange R) { NSString *aString = 0; - return [s compare:aString options:op range:R locale:0]; // expected-warning {{Argument to 'NSString' method 'compare:options:range:locale:' cannot be nil.}} + return [s compare:aString options:op range:R locale:0]; // expected-warning {{Argument to 'NSString' method 'compare:options:range:locale:' cannot be nil}} } NSArray *f6(NSString* s) { - return [s componentsSeparatedByCharactersInSet:0]; // expected-warning {{Argument to 'NSString' method 'componentsSeparatedByCharactersInSet:' cannot be nil.}} + return [s componentsSeparatedByCharactersInSet:0]; // expected-warning {{Argument to 'NSString' method 'componentsSeparatedByCharactersInSet:' cannot be nil}} } NSString* f7(NSString* s1, NSString* s2, NSString* s3) { @@ -189,7 +189,7 @@ void f13(void) { @end void f14(MyString *s) { - [s compare:0]; // expected-warning {{Argument to 'MyString' method 'compare:' cannot be nil.}} + [s compare:0]; // expected-warning {{Argument to 'MyString' method 'compare:' cannot be nil}} } // Test regular use of -autorelease diff --git a/test/Analysis/method-arg-decay.m b/test/Analysis/method-arg-decay.m index 9ce88b2423..ffe28afc4d 100644 --- a/test/Analysis/method-arg-decay.m +++ b/test/Analysis/method-arg-decay.m @@ -73,7 +73,7 @@ extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExpos - (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}} @end @implementation XCPerspectiveModule // expected-warning {{incomplete implementation}} \ - // expected-warning {{method in protocol not implemented [-Wprotocol]}} + // expected-warning {{method in protocol not implemented}} + (void) openForProjectDocument:(PBXProjectDocument *)projectDocument { } - (PBXModule *) type:(Class)type inPerspective:(id)perspectiveIdentifer matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data { diff --git a/test/Analysis/retain-release-path-notes-gc.m b/test/Analysis/retain-release-path-notes-gc.m index 19e6d7b8b3..1e74f003e1 100644 --- a/test/Analysis/retain-release-path-notes-gc.m +++ b/test/Analysis/retain-r |