]> granicus.if.org Git - clang/commitdiff
Simplify ArrayToPointer conversion. Actually the only thing we need to do is to get...
authorZhongxing Xu <xuzhongxing@gmail.com>
Sun, 26 Oct 2008 02:23:57 +0000 (02:23 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Sun, 26 Oct 2008 02:23:57 +0000 (02:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58181 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp

index eabe462cc7b36c335146feee63f9a517b5c64f21..84f543ede4505572be3f9f23bc1b33de4e5fafd3 100644 (file)
@@ -197,35 +197,11 @@ SVal RegionStoreManager::ArrayToPointer(SVal Array) {
   const MemRegion* ArrayR = cast<loc::MemRegionVal>(&Array)->getRegion();
   BasicValueFactory& BasicVals = StateMgr.getBasicVals();
 
-  if (const StringRegion* StringR = dyn_cast<StringRegion>(ArrayR)) {
-    // FIXME: Find a better way to get bit width.
-    nonloc::ConcreteInt Idx(BasicVals.getValue(0, 32, false));
-    ElementRegion* ER = MRMgr.getElementRegion(Idx, ArrayR);
-    
-    return loc::MemRegionVal(ER);                    
-  }
-
-  const Decl* D = cast<DeclRegion>(ArrayR)->getDecl();
-
-  QualType ArrayTy;
-  if (const VarDecl* VD = dyn_cast<VarDecl>(D))
-    ArrayTy = VD->getType();
-  else if (const FieldDecl* FD = dyn_cast<FieldDecl>(D))
-    ArrayTy = FD->getType(); 
-  else
-    assert(0 && "unknown decl");
-
-  if (const ConstantArrayType* CAT = 
-      dyn_cast<ConstantArrayType>(ArrayTy.getTypePtr())) {
-    
-    nonloc::ConcreteInt Idx(BasicVals.getValue(0, CAT->getSize().getBitWidth(),
-                                               false));
-    ElementRegion* ER = MRMgr.getElementRegion(Idx, ArrayR);
-    
-    return loc::MemRegionVal(ER);
-  }
-
-  return Array;
+  // FIXME: Find a better way to get bit width.
+  nonloc::ConcreteInt Idx(BasicVals.getValue(0, 32, false));
+  ElementRegion* ER = MRMgr.getElementRegion(Idx, ArrayR);
+  
+  return loc::MemRegionVal(ER);                    
 }
 
 SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) {