r180075 - [analyzer] RetainCountChecker: Clean up path notes for autorelease.
Jordan Rose
jordan_rose at apple.com
Mon Apr 22 18:42:26 PDT 2013
Author: jrose
Date: Mon Apr 22 20:42:25 2013
New Revision: 180075
URL: http://llvm.org/viewvc/llvm-project?rev=180075&view=rev
Log:
[analyzer] RetainCountChecker: Clean up path notes for autorelease.
No functionality change.
<rdar://problem/13710586>
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
cfe/trunk/test/Analysis/objc-subscript.m
cfe/trunk/test/Analysis/properties.m
cfe/trunk/test/Analysis/retain-release-path-notes.m
cfe/trunk/test/Analysis/retain-release.m
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=180075&r1=180074&r2=180075&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Mon Apr 22 20:42:25 2013
@@ -326,7 +326,7 @@ void RefVal::print(raw_ostream &Out) con
break;
case RefVal::ErrorOverAutorelease:
- Out << "Over autoreleased";
+ Out << "Over-autoreleased";
break;
case RefVal::ErrorReturnedNotOwned:
@@ -1662,10 +1662,10 @@ namespace {
class OverAutorelease : public CFRefBug {
public:
OverAutorelease()
- : CFRefBug("Object sent -autorelease too many times") {}
+ : CFRefBug("Object autoreleased too many times") {}
const char *getDescription() const {
- return "Object sent -autorelease too many times";
+ return "Object autoreleased too many times";
}
};
@@ -2050,7 +2050,7 @@ PathDiagnosticPiece *CFRefReportVisitor:
return 0;
assert(PrevV.getAutoreleaseCount() < CurrV.getAutoreleaseCount());
- os << "Object sent -autorelease message";
+ os << "Object autoreleased";
break;
}
@@ -3554,10 +3554,12 @@ RetainCountChecker::handleAutoreleaseCou
if (N) {
SmallString<128> sbuf;
llvm::raw_svector_ostream os(sbuf);
- os << "Object over-autoreleased: object was sent -autorelease ";
+ os << "Object was autoreleased ";
if (V.getAutoreleaseCount() > 1)
- os << V.getAutoreleaseCount() << " times ";
- os << "but the object has a +" << V.getCount() << " retain count";
+ os << V.getAutoreleaseCount() << " times but the object ";
+ else
+ os << "but ";
+ os << "has a +" << V.getCount() << " retain count";
if (!overAutorelease)
overAutorelease.reset(new OverAutorelease());
Modified: cfe/trunk/test/Analysis/objc-subscript.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/objc-subscript.m?rev=180075&r1=180074&r2=180075&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/objc-subscript.m (original)
+++ cfe/trunk/test/Analysis/objc-subscript.m Mon Apr 22 20:42:25 2013
@@ -39,9 +39,9 @@ typedef unsigned int NSUInteger;
// <rdar://problem/8824416> for subscripting
- (id)getDoesNotRetain:(BOOL)keyed {
if (keyed)
- return [self[self] autorelease]; // expected-warning{{Object sent -autorelease too many times}}
+ return [self[self] autorelease]; // expected-warning{{Object autoreleased too many times}}
else
- return [self[0] autorelease]; // expected-warning{{Object sent -autorelease too many times}}
+ return [self[0] autorelease]; // expected-warning{{Object autoreleased too many times}}
}
// <rdar://problem/9241180> for subscripting
Modified: cfe/trunk/test/Analysis/properties.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/properties.m?rev=180075&r1=180074&r2=180075&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/properties.m (original)
+++ cfe/trunk/test/Analysis/properties.m Mon Apr 22 20:42:25 2013
@@ -102,7 +102,7 @@ typedef struct _NSZone NSZone;
else
value = [[NSNumber alloc] initWithInteger:0];
- return [value autorelease]; // expected-warning {{Object sent -autorelease too many times}}
+ return [value autorelease]; // expected-warning {{Object autoreleased too many times}}
}
@end
@@ -111,7 +111,7 @@ NSNumber* numberFromMyNumberProperty(MyN
{
NSNumber* result = aMyNumber.myNumber;
- return [result autorelease]; // expected-warning {{Object sent -autorelease too many times}}
+ return [result autorelease]; // expected-warning {{Object autoreleased too many times}}
}
Modified: cfe/trunk/test/Analysis/retain-release-path-notes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-path-notes.m?rev=180075&r1=180074&r2=180075&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release-path-notes.m (original)
+++ cfe/trunk/test/Analysis/retain-release-path-notes.m Mon Apr 22 20:42:25 2013
@@ -86,15 +86,15 @@ void implicitDealloc () {
void overAutorelease () {
id object = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
- [object autorelease]; // expected-note{{Object sent -autorelease message}}
- [object autorelease]; // expected-note{{Object sent -autorelease message}}
- return; // expected-warning{{Object sent -autorelease too many times}} expected-note{{Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count}}
+ [object autorelease]; // expected-note{{Object autoreleased}}
+ [object autorelease]; // expected-note{{Object autoreleased}}
+ return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +1 retain count}}
}
void autoreleaseUnowned (Foo *foo) {
id object = foo.propertyValue; // expected-note{{Property returns an Objective-C object with a +0 retain count}}
- [object autorelease]; // expected-note{{Object sent -autorelease message}}
- return; // expected-warning{{Object sent -autorelease too many times}} expected-note{{Object over-autoreleased: object was sent -autorelease but the object has a +0 retain count}}
+ [object autorelease]; // expected-note{{Object autoreleased}}
+ return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased but has a +0 retain count}}
}
void makeCollectableIgnored () {
@@ -137,7 +137,7 @@ CFTypeRef CFGetRuleViolation () {
- (id)copyAutorelease {
id result = [[Foo alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
- [result autorelease]; // expected-note{{Object sent -autorelease message}}
+ [result autorelease]; // expected-note{{Object autoreleased}}
return result; // expected-warning{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}} expected-note{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}}
}
@end
@@ -1906,9 +1906,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -1981,9 +1981,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -2044,14 +2044,14 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>description</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
-// CHECK-NEXT: <key>type</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>type</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: <key>issue_context</key><string>overAutorelease</string>
// CHECK-NEXT: <key>issue_hash</key><string>4</string>
@@ -2199,9 +2199,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -2262,14 +2262,14 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease but the object has a +0 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased but has a +0 retain count</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease but the object has a +0 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased but has a +0 retain count</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>description</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
-// CHECK-NEXT: <key>type</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>type</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: <key>issue_context</key><string>autoreleaseUnowned</string>
// CHECK-NEXT: <key>issue_hash</key><string>3</string>
@@ -3814,9 +3814,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=180075&r1=180074&r2=180075&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Mon Apr 22 20:42:25 2013
@@ -479,20 +479,20 @@ void f13_autorelease_b() {
CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
[(id) A autorelease];
[(id) A autorelease];
-} // expected-warning{{Object sent -autorelease too many times}}
+} // expected-warning{{Object autoreleased too many times}}
CFMutableArrayRef f13_autorelease_c() {
CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
[(id) A autorelease];
[(id) A autorelease];
- return A; // expected-warning{{Object sent -autorelease too many times}}
+ return A; // expected-warning{{Object autoreleased too many times}}
}
CFMutableArrayRef f13_autorelease_d() {
CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
[(id) A autorelease];
[(id) A autorelease];
- CFMutableArrayRef B = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{Object sent -autorelease too many times}}
+ CFMutableArrayRef B = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{Object autoreleased too many times}}
CFRelease(B); // no-warning
while (1) {}
}
@@ -8929,9 +8929,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9004,9 +9004,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9052,14 +9052,14 @@ static int Cond;
// CHECK-NEXT: </dict>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>description</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
-// CHECK-NEXT: <key>type</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>type</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: <key>issue_context</key><string>f13_autorelease_b</string>
// CHECK-NEXT: <key>issue_hash</key><string>4</string>
@@ -9207,9 +9207,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9282,9 +9282,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9345,14 +9345,14 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +0 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +0 retain count</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +0 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +0 retain count</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>description</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
-// CHECK-NEXT: <key>type</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>type</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: <key>issue_context</key><string>f13_autorelease_c</string>
// CHECK-NEXT: <key>issue_hash</key><string>4</string>
@@ -9500,9 +9500,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9575,9 +9575,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -9672,14 +9672,14 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object over-autoreleased: object was sent -autorelease 2 times but the object has a +1 retain count</string>
+// CHECK-NEXT: <string>Object was autoreleased 2 times but the object has a +1 retain count</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>description</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
-// CHECK-NEXT: <key>type</key><string>Object sent -autorelease too many times</string>
+// CHECK-NEXT: <key>type</key><string>Object autoreleased too many times</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: <key>issue_context</key><string>f13_autorelease_d</string>
// CHECK-NEXT: <key>issue_hash</key><string>4</string>
@@ -13605,9 +13605,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -20127,9 +20127,9 @@ static int Cond;
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>depth</key><integer>0</integer>
// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Object sent -autorelease message</string>
+// CHECK-NEXT: <string>Object autoreleased</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
More information about the cfe-commits
mailing list