[LLVMdev] newbie question for type comparison
Gordon Henriksen
gordonhenriksen at mac.com
Mon Apr 21 13:17:21 PDT 2008
On Apr 21, 2008, at 15:39, John Criswell wrote:
> Gordon Henriksen wrote:
>
>> On Apr 21, 2008, at 15:07, John Criswell wrote:
>>
>>> if (AI->getAllocatedType()->getTypeID() == Type::StructTyID)
>>
>> Better: if (isa<StructType>) or if (StructType *sT =
>> dyn_cast<StructType>).
>>
>
> Just out of curiosity, what is it better? Does it use less virtual
> function calls?
No (it calls getTypeID) but it's more readable and in general respects
subtypes.
— Gordon
More information about the llvm-dev
mailing list