[cfe-commits] r58137 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/MemRegion.cpp

Ted Kremenek kremenek at apple.com
Sat Oct 25 12:47:37 PDT 2008


On Oct 25, 2008, at 7:13 AM, Zhongxing Xu wrote:

> /// AnonTypedRegion - An "anonymous" region that simply types a chunk
> ///  of memory.
> class AnonTypedRegion : public TypedRegion {
> @@ -195,6 +227,11 @@
> public:
>   const Decl* getDecl() const { return D; }
>   void Profile(llvm::FoldingSetNodeID& ID) const;
> +
> +  static bool classof(const MemRegion* R) {
> +    unsigned k = R->getKind();
> +    return k > BEG_DECL_REGIONS && k < END_DECL_REGIONS;
> +  }
> };

Hi Zhongxing,

Can you tell me what your motivation was for implementing 'classof'  
for AnonTypedRegion in this way?  This will return true if the  
MemRegion is a VarRegion or a FieldRegion, but not if it is an  
instance of AnonTypedRegion (!).  AnonTypedRegion is just meant to be  
some lightweight layering on top of an existing region where we want  
to add some typing information to a set of bytes.

Ted



More information about the cfe-commits mailing list