[llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h

Duncan Sands baldrick at free.fr
Mon Feb 8 20:38:04 PST 2010


Hi Chris,

>>> Why not just use isa<PointerType>?
>>> This encourages code to diverge in style.
>>
>> since there already is isFloat, isInteger and variations, it seems odd 
>> not
>> to have these too.  Of course, I could just delete all the guys with 
>> an "isa"
>> version.  What do you think?
> 
> isInteger is required because we need an argument.

actually there are two versions of isInteger, one which takes a bitwidth
argument, and one which just checks the ID.

I don't really care
> one way or another though, so long as the code is consistent.  Are you 
> willing to change all isa<PointerType>(x) to X->isPointer() ?

I was actually suggesting getting rid of all the

   bool isInteger() const { return ID == IntegerTyID; }

style methods, and changing them to isa<IntegerType> etc (I guess I didn't
phrase this clearly).  However, I might be persuaded to do it the other way
round :)  An argument is favour of ...->isInteger() is that it is about 30%
shorter than isa<IntegerType>(...).  On the other hand, "isa" is consistent
with all the other classes, isa<BitCastInst> etc.  Personally I'm not fussed
by having both styles, but if you feel strongly about it I am prepared to do
some work to improve the situation.

Ciao,

Duncan.



More information about the llvm-commits mailing list