]> granicus.if.org Git - clang/commitdiff
String comparison cleanups.
authorTed Kremenek <kremenek@apple.com>
Tue, 6 May 2008 04:28:05 +0000 (04:28 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 6 May 2008 04:28:05 +0000 (04:28 +0000)
Added test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50711 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp
test/Analysis-Apple/CFDate.m

index 040445b20bcbaafc0aa525aa862e122374b18532..4a20fbec87f0e116826f52fbcc4f26cde11bb893 100644 (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;
index 4f39fc68eb049fd795b48be43d0eb2c68ae619a3..e71b1a08faccb6dc5dbdf6c042f50c2116d7a95c 100644 (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}}
+}
+