[llvm-branch-commits] [cfe-branch] r71464 - in /cfe/branches/Apple/Dib: lib/Analysis/CFRefCount.cpp test/Analysis/retain-release.m
Mike Stump
mrs at apple.com
Mon May 11 12:02:40 PDT 2009
Author: mrs
Date: Mon May 11 14:02:40 2009
New Revision: 71464
URL: http://llvm.org/viewvc/llvm-project?rev=71464&view=rev
Log:
Merge in 71452:
Fix regression reported in <rdar://problem/6866843>. The analyzer should extend the lifetime of an object stored to a container.
Modified:
cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
cfe/branches/Apple/Dib/test/Analysis/retain-release.m
Modified: cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp?rev=71464&r1=71463&r2=71464&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp Mon May 11 14:02:40 2009
@@ -752,8 +752,8 @@
: RetEffect::MakeOwned(RetEffect::ObjC, true)),
DefaultSummary(AF.GetEmptyMap() /* per-argument effects (none) */,
RetEffect::MakeNoRet() /* return effect */,
- DoNothing /* receiver effect */,
- MayEscape /* default argument effect */),
+ MayEscape, /* default argument effect */
+ DoNothing /* receiver effect */),
StopSummary(0) {
InitializeClassMethodSummaries();
Modified: cfe/branches/Apple/Dib/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/retain-release.m?rev=71464&r1=71463&r2=71464&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/retain-release.m (original)
+++ cfe/branches/Apple/Dib/test/Analysis/retain-release.m Mon May 11 14:02:40 2009
@@ -476,7 +476,7 @@
// <rdar://problem/6833332>
// One build of the analyzer accidentally stopped tracking the allocated
// object after the 'retain'.
-//===----------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
@interface rdar_6833332 : NSObject <NSApplicationDelegate> {
NSWindow *window;
@@ -503,7 +503,7 @@
// <rdar://problem/6257780> clang checker fails to catch use-after-release
//===----------------------------------------------------------------------===//
-int rdar_6257780() {
+int rdar_6257780_Case1() {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *array = [NSArray array];
[array release]; // expected-warning{{Incorrect decrement of the reference count of an object is not owned at this point by the caller}}
@@ -512,6 +512,23 @@
}
//===----------------------------------------------------------------------===//
+// <rdar://problem/6866843> Checker should understand new/setObject:/release constructs
+//===----------------------------------------------------------------------===//
+
+void rdar_6866843() {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
+ NSArray* array = [[NSArray alloc] init];
+ [dictionary setObject:array forKey:@"key"];
+ [array release];
+ // Using 'array' here should be fine
+ NSLog(@"array = %@\n", array); // no-warning
+ // Now the array is released
+ [dictionary release];
+ [pool drain];
+}
+
+//===----------------------------------------------------------------------===//
// Tests of ownership attributes.
//===----------------------------------------------------------------------===//
More information about the llvm-branch-commits
mailing list