From 2f08fedec1f4c6f92ff4afb4aeda07bc36d953aa Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 6 May 2008 04:28:05 +0000 Subject: [PATCH] String comparison cleanups. Added test case. llvm-svn: 50711 --- clang/lib/Analysis/CFRefCount.cpp | 2 +- clang/test/Analysis-Apple/CFDate.m | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index 040445b20bcb..4a20fbec87f0 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/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/clang/test/Analysis-Apple/CFDate.m b/clang/test/Analysis-Apple/CFDate.m index 4f39fc68eb04..e71b1a08facc 100644 --- a/clang/test/Analysis-Apple/CFDate.m +++ b/clang/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}} +} +