[llvm-dev] How to know the sub-class of a Value class?

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 11 23:20:30 PDT 2017


On Sun, Jun 11, 2017 at 11:12 PM, Dipanjan Das via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
>
> On 11 June 2017 at 23:06, Jeremy Lakeman <Jeremy.Lakeman at gmail.com> wrote:
>>
>>
>> http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates
>
>
> I understand isa and dyn-cast let you test the type of an object at run-time
> by leveraging LLVM's custom implementation of RTTI. However, it doesn't make
> much sense to test out for all possible sub-classes to get to know what it
> actually is. If I just want to know sub-class a Value* is, what's the way
> out (other than testing with isa<>())?

Does this pattern (or some variant of it) solve your problem:
https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis/BasicAliasAnalysis.cpp#L232

?

-- Sanjoy


More information about the llvm-dev mailing list