]> granicus.if.org Git - clang/commitdiff
Enhance SVals::getAsRegion: get the region that is converted to an integer.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 11 Jan 2010 06:52:53 +0000 (06:52 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 11 Jan 2010 06:52:53 +0000 (06:52 +0000)
This with previous patch fixes a OSAtomic test case.

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

lib/Analysis/SVals.cpp
test/Analysis/NSString-failed-cases.m
test/Analysis/NSString.m

index 9163b2725273ae2b6567b50f04606d1a8a5aae76..fbdb73b0ef2e8de2b9050f98f5be9b742742eedc 100644 (file)
@@ -97,6 +97,10 @@ const MemRegion *SVal::getAsRegion() const {
   if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this))
     return X->getRegion();
 
+  if (const nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(this)) {
+    return X->getLoc().getAsRegion();
+  }
+
   return 0;
 }
 
index 2b8242f0d019d02aa5291148a9556dd6ec26121e..699d142eecb431a7f2c12069de68f552cd4c3d08 100644 (file)
@@ -96,15 +96,6 @@ extern void *_NSConstantStringClassReference;
 //  stop reporting leaks.
 //===----------------------------------------------------------------------===//
 
-// FIXME: THIS TEST CASE INCORRECTLY REPORTS A LEAK.
-void testOSCompareAndSwapXXBarrier_parameter(NSString **old) {
-  NSString *s = [[NSString alloc] init]; // no-warning
-  if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) old))
-    [s release];
-  else    
-    [*old release];
-}
-
 // FIXME: THIS TEST CASE INCORRECTLY REPORTS A LEAK.
 void testOSCompareAndSwapXXBarrier_parameter_no_direct_release(NSString **old) {
   NSString *s = [[NSString alloc] init]; // no-warning
index fb44309b124897599178acbc0e8f0923a06af731..b5d510a5ed98d127144ea6a97c1172076cd336fd 100644 (file)
@@ -388,3 +388,11 @@ void test_synchronized(id x) {
   }
 }
 @end
+
+void testOSCompareAndSwapXXBarrier_parameter(NSString **old) {
+  NSString *s = [[NSString alloc] init]; // no-warning
+  if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) old))
+    [s release];
+  else    
+    [*old release];
+}