[llvm-commits] [PATCH] TargetData::getIntPtrType() to return IntegerType

Nick Lewycky nicholas at mxc.ca
Thu May 7 23:05:01 PDT 2009


Jay Foad wrote:
> The attached patch lets me avoid some casts to IntegerType in some
> code I'm working on. Thoughts? It passes regression tests and cfe and
> llvm-gcc still build.
> 
> It's a bit unfortunate that TargetData.h has to include
> DerivedTypes.h, but otherwise this would break code like:
> 
>   const Type *Ty = TD->getIntPtrType();
> 
> which now needs to know that IntegerType is derived from Type.

Your patch looks good to me. You could declare "class IntegerType;" and 
require that users of getIntPtrType who want to write code like the 
above need to #include DerivedTypes.h themselves, but I'm not sure 
that's really an improvement.

Nick




More information about the llvm-commits mailing list