diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-10-24 09:06:51 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-10-24 09:06:51 +0000 |
commit | bfb6582ef46dfb33672d9621f879fc262339d704 (patch) | |
tree | 0e5ec087f327ccef3824878d3e7f55393c4da8a9 /lib/Analysis/RegionStore.cpp | |
parent | 72e1682bbdfd497ce838d648bb2cb6047c015f6f (diff) |
The Decl of an array region can be VarDecl or FieldDecl. Handle this in RegionStoreManager::ArrayToPointer().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index bd3dd0911d..5c75ab369e 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -181,10 +181,18 @@ SVal RegionStoreManager::getLValueElement(const GRState* St, SVal RegionStoreManager::ArrayToPointer(SVal Array) { const MemRegion* ArrayR = cast<loc::MemRegionVal>(&Array)->getRegion(); - const VarDecl* D = cast<VarRegion>(ArrayR)->getDecl(); + 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>(D->getType().getTypePtr())) { + dyn_cast<ConstantArrayType>(ArrayTy.getTypePtr())) { BasicValueFactory& BasicVals = StateMgr.getBasicVals(); |