Author: zhongxingxu
Date: Sat Oct 25 21:23:57 2008
New Revision: 58181
URL: http://llvm.org/viewvc/llvm-project?rev=58181&view=rev
Log:
Simplify ArrayToPointer conversion. Actually the only thing we need to do is to
get the first element region. It is not necessary to care about the kind of the
base array region.
Modified:
cfe/trunk/lib/Analysis/RegionStore.cpp
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=58181&r1=58180&r2=58181&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Sat Oct 25 21:23:57 2008
@@ -197,35 +197,11 @@
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) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits