[cfe-commits] r66655 - /cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
Ted Kremenek
kremenek at apple.com
Wed Mar 11 13:28:16 PDT 2009
Zhongxing,
I'm going to retract my statement. I think TypedRegion is expecting
'T' to be the lvalue type, but I'm getting lots of crashes with your
patch in place. I'll investigate further.
On Mar 11, 2009, at 1:14 PM, Ted Kremenek wrote:
> 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