summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-10-26 02:23:57 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-10-26 02:23:57 +0000
commitbf47dc85fe30a1bef85c3eead5675bd3dbeb8221 (patch)
tree06593f461d5c0bf1903ef1dcee54d78d0304d6b9 /clang
parent07d9f9a6ec53217634a5dcb812a0b2ac9186334f (diff)
downloadbcm5719-llvm-bf47dc85fe30a1bef85c3eead5675bd3dbeb8221.tar.gz
bcm5719-llvm-bf47dc85fe30a1bef85c3eead5675bd3dbeb8221.zip
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.
llvm-svn: 58181
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index eabe462cc7b..84f543ede45 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -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) {
OpenPOWER on IntegriCloud