String comparison cleanups.

Added test case.

llvm-svn: 50711
This commit is contained in:
Ted Kremenek 2008-05-06 04:28:05 +00:00
parent 041d02201f
commit 2f08fedec1
2 changed files with 12 additions and 1 deletions

View File

@ -636,7 +636,7 @@ RetainSummaryManager::getInstanceMethodSummary(IdentifierInfo* ClsName,
if (s[0] == '\0')
break;
if (s[0]!='W' || s[1]!='i' || s[2]!='t' || s[3]!='h')
if (!strncmp(s, "With", 4))
break;
return 0;

View File

@ -2,6 +2,8 @@
#include <CoreFoundation/CFDate.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSCalendarDate.h>
#include <Foundation/NSString.h>
CFAbsoluteTime f1() {
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
@ -102,3 +104,12 @@ NSDate* f8(int x) {
return date; // expected-warning{{leak}}
}
NSDate* f9(int x) {
NSDate* date = [NSDate dateWithString:@"2001-03-24 10:45:32 +0600"];
if (x) [date retain];
return date; // expected-warning{{leak}}
}