<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 11 June 2017 at 23:06, Jeremy Lakeman <span dir="ltr"><<a href="mailto:Jeremy.Lakeman@gmail.com" target="_blank">Jeremy.Lakeman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><a href="http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates" target="_blank">http://llvm.org/docs/<wbr>ProgrammersManual.html#the-<wbr>isa-cast-and-dyn-cast-<wbr>templates</a></div></blockquote><div><br></div><div>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<>())?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 3:24 PM, Dipanjan Das via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>As a concrete question, I understand 'Value' class is the parent of many concrete sub-classes. Let's say I retrieve a Value* value = store_inst->getValueOperand(). Unless I know what the sub-type is, how can I further use this object? I tried something like this:</div><div><br></div><div>==============================<wbr>===================</div><div><br></div><div>         Value* value = store_inst->getValueOperand()</div><div>         errs() << value->getValueID; // Which ID corresponds to which sub-class?</div><div>         errs() << value->getValueName(); // Prints numeric memory addresses</div><div>         errs() << *value->getValueName(); // Doesn't compile       </div><div>         </div><div>==============================<wbr>===================<br clear="all"><div><br></div><div>I have mentioned the issues in each of the cases above. I am not sure if the approach is correct or not. Please help me out.</div><span class="HOEnZb"><font color="#888888"><span class="m_4701400206651700867HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_4701400206651700867m_-663785564093095553gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</font></span></font></span></div></div><span class="HOEnZb"><font color="#888888">
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></font></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div></div>