[cfe-commits] r66655 - /cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
Ted Kremenek
kremenek at apple.com
Wed Mar 11 13:14:33 PDT 2009
Zhongxing,
This looks wrong, and I think it seriously breaks things. I'm seeing
a ton of crashes related to this patch.
The value 'T' is the rvalue type of the region, not the lvalue type.
Observe the definition of TypedRegion::getLValueType():
/// TypedRegion - An abstract class representing regions that are typed.
class TypedRegion : public SubRegion {
protected:
TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {}
public:
virtual QualType getRValueType(ASTContext &C) const = 0;
virtual QualType getLValueType(ASTContext& C) const {
// FIXME: We can possibly optimize this later to cache this value.
return C.getPointerType(getRValueType(C));
}
On Mar 11, 2009, at 2:10 AM, Zhongxing Xu wrote:
> Author: zhongxingxu
> Date: Wed Mar 11 04:10:39 2009
> New Revision: 66655
>
> URL: http://llvm.org/viewvc/llvm-project?rev=66655&view=rev
> Log:
> The RValueType of a TypedViewRegion should be the pointee type.
>
> Modified:
> cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
>
> 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=66655&r1=66654&r2=66655&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
> (original)
> +++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Wed
> Mar 11 04:10:39 2009
> @@ -252,7 +252,9 @@
> void print(llvm::raw_ostream& os) const;
>
> QualType getRValueType(ASTContext&) const {
> - return T;
> + const PointerType* PTy = T->getAsPointerType();
> + assert(PTy);
> + return PTy->getPointeeType();
> }
>
> void Profile(llvm::FoldingSetNodeID& ID) const {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list