From: Ted Kremenek Date: Tue, 6 May 2008 04:28:05 +0000 (+0000) Subject: String comparison cleanups. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70f9d8652b34967b2c356f4edf0a701094a5d2d3;p=clang String comparison cleanups. Added test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50711 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 040445b20b..4a20fbec87 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -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; diff --git a/test/Analysis-Apple/CFDate.m b/test/Analysis-Apple/CFDate.m index 4f39fc68eb..e71b1a08fa 100644 --- a/test/Analysis-Apple/CFDate.m +++ b/test/Analysis-Apple/CFDate.m @@ -2,6 +2,8 @@ #include #include +#include +#include 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}} +} +