[cfe-commits] r122393 - /cfe/trunk/lib/Checker/RegionStore.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Dec 22 00:12:57 PST 2010
Author: zhongxingxu
Date: Wed Dec 22 02:12:57 2010
New Revision: 122393
URL: http://llvm.org/viewvc/llvm-project?rev=122393&view=rev
Log:
The base type is not always pointer type. We may cast to a base reference.
Modified:
cfe/trunk/lib/Checker/RegionStore.cpp
Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=122393&r1=122392&r2=122393&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Wed Dec 22 02:12:57 2010
@@ -807,9 +807,15 @@
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());
More information about the cfe-commits
mailing list