[cfe-commits] r66712 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/MemRegion.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Mar 11 19:05:04 PDT 2009
On Thu, Mar 12, 2009 at 5:57 AM, Ted Kremenek <kremenek at apple.com> wrote:
> Author: kremenek
> Date: Wed Mar 11 16:57:34 2009
> New Revision: 66712
>
> URL: http://llvm.org/viewvc/llvm-project?rev=66712&view=rev
> Log:
> Add TypedViewRegion::isBoundable() to indicate whether or not the
> TypedViewRegion has a valid rvalue type. Also renamed instance variable 'T'
> to
> 'LvalueType' to make it unambiguous of its purpose.
>
> This fixes some crashes I was seeing after:
>
>
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090309/013771.html
>
> This is because 'isBoundable()' is defined in TypedRegion (the parent
> class) in
> terms of the rvalue type (which could be null),
Hi Ted, I am curious when the rvalue type could be null? Could you please
provide a test case caused to crash by my previous patch?
> while for TypedViewRegion it
> should be defined in terms of the lvalue type.
>
> Modified:
> cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
> cfe/trunk/lib/Analysis/MemRegion.cpp
>
> Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=66712&r1=66711&r2=66712&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
> +++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Wed Mar 11
> 16:57:34 2009
> @@ -239,10 +239,10 @@
> class TypedViewRegion : public TypedRegion {
> friend class MemRegionManager;
>
> - QualType T;
> + QualType LValueType;
>
> - TypedViewRegion(QualType t, const MemRegion* sreg)
> - : TypedRegion(sreg, TypedViewRegionKind), T(t) {}
> + TypedViewRegion(QualType lvalueType, const MemRegion* sreg)
> + : TypedRegion(sreg, TypedViewRegionKind), LValueType(lvalueType) {}
>
> static void ProfileRegion(llvm::FoldingSetNodeID& ID, QualType T,
> const MemRegion* superRegion);
> @@ -252,13 +252,17 @@
> void print(llvm::raw_ostream& os) const;
>
> QualType getRValueType(ASTContext&) const {
> - const PointerType* PTy = T->getAsPointerType();
> + const PointerType* PTy = LValueType->getAsPointerType();
> assert(PTy);
> return PTy->getPointeeType();
> }
> +
> + bool isBoundable(ASTContext &C) const {
> + return isa<PointerType>(LValueType);
> + }
>
> void Profile(llvm::FoldingSetNodeID& ID) const {
> - ProfileRegion(ID, T, superRegion);
> + ProfileRegion(ID, LValueType, superRegion);
> }
>
> static bool classof(const MemRegion* R) {
> @@ -561,7 +565,8 @@
> ObjCIvarRegion* getObjCIvarRegion(const ObjCIvarDecl* ivd,
> const MemRegion* superRegion);
>
> - TypedViewRegion* getTypedViewRegion(QualType t, const MemRegion*
> superRegion);
> + TypedViewRegion* getTypedViewRegion(QualType LValueType,
> + const MemRegion* superRegion);
>
> bool hasStackStorage(const MemRegion* R);
>
>
> Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=66712&r1=66711&r2=66712&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
> +++ cfe/trunk/lib/Analysis/MemRegion.cpp Wed Mar 11 16:57:34 2009
> @@ -172,7 +172,7 @@
> }
>
> void TypedViewRegion::print(llvm::raw_ostream& os) const {
> - os << "typed_view{" << T.getAsString() << ',';
> + os << "typed_view{" << LValueType.getAsString() << ',';
> getSuperRegion()->print(os);
> os << '}';
> }
>
>
> _______________________________________________
> 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/20090312/71a23180/attachment.html>
More information about the cfe-commits
mailing list