summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-12-22 08:12:57 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-12-22 08:12:57 +0000
commitfe86bc527a0d50b653d2df8fa8b091a5397d3a9d (patch)
treeae5e7b94eec9727085a49dec87fc5f138a78055e /clang/lib
parentcafc1e60bb25db63a8d4dacf1cd026937aab217a (diff)
downloadbcm5719-llvm-fe86bc527a0d50b653d2df8fa8b091a5397d3a9d.tar.gz
bcm5719-llvm-fe86bc527a0d50b653d2df8fa8b091a5397d3a9d.zip
The base type is not always pointer type. We may cast to a base reference.
llvm-svn: 122393
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Checker/RegionStore.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp
index bc28f137c45..b6f992995b0 100644
--- a/clang/lib/Checker/RegionStore.cpp
+++ b/clang/lib/Checker/RegionStore.cpp
@@ -807,9 +807,15 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) {
return loc::MemRegionVal(MRMgr.getElementRegion(T, ZeroIdx, ArrayR, Ctx));
}
-SVal RegionStoreManager::evalDerivedToBase(SVal derived, QualType basePtrType) {
- const CXXRecordDecl *baseDecl = basePtrType->getCXXRecordDeclForPointerType();
+SVal RegionStoreManager::evalDerivedToBase(SVal derived, QualType baseType) {
+ const CXXRecordDecl *baseDecl;
+ if (baseType->isPointerType())
+ baseDecl = baseType->getCXXRecordDeclForPointerType();
+ else
+ baseDecl = baseType->getAsCXXRecordDecl();
+
assert(baseDecl && "not a CXXRecordDecl?");
+
loc::MemRegionVal &derivedRegVal = cast<loc::MemRegionVal>(derived);
const MemRegion *baseReg =
MRMgr.getCXXBaseObjectRegion(baseDecl, derivedRegVal.getRegion());
OpenPOWER on IntegriCloud