[cfe-commits] r122393 - /cfe/trunk/lib/Checker/RegionStore.cpp

Xu Zhongxing xuzhongxing at gmail.com
Wed Dec 22 19:51:46 PST 2010


It is in misc-ps-region-store.cpp

class Test3_Base {};
class Test3_Derived : public Test3_Base {};

int test3_aux(Test3_Base &x);
int test3(Test3_Derived x) {
  return test3_aux(x);
}

On Thu, Dec 23, 2010 at 3:49 AM, Ted Kremenek <kremenek at apple.com> wrote:

> Test case?
>
> On Dec 22, 2010, at 12:12 AM, Zhongxing Xu wrote:
>
> > 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());
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101223/2d181060/attachment.html>


More information about the cfe-commits mailing list