<div dir="ltr"><div><div><div><div><div><div>Sure you could do that. eg;<br></div><a href="https://github.com/llvm-mirror/llvm/blob/e3e43d9d574cf0a829e9a58525372ba0868a3292/lib/IR/Globals.cpp#L85">https://github.com/llvm-mirror/llvm/blob/e3e43d9d574cf0a829e9a58525372ba0868a3292/lib/IR/Globals.cpp#L85</a><br><br></div>Or use the enum names;<br><a href="https://github.com/llvm-mirror/llvm/blob/e3e43d9d574cf0a829e9a58525372ba0868a3292/lib/Transforms/Utils/FunctionComparator.cpp#L248">https://github.com/llvm-mirror/llvm/blob/e3e43d9d574cf0a829e9a58525372ba0868a3292/lib/Transforms/Utils/FunctionComparator.cpp#L248</a><br><br></div>Like I said, how you determine what you're looking at might change based on what you want to do with each subclass of Value, which still hasn't been clarified.<br><br></div>You get better answers if you ask more specific questions and provided more context. And lately it seems like you've been asking a lot of questions.<br><br>Why do you need to know the specific type of a Value * ? <br>Or, implicit in your question, what types of stored values are you looking for?<br></div>Do you want to look through bitcasts to discover the source Value?<br></div>Is this an attempt to get a different answer to your "[llvm-dev] Force casting a Value*" question?<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 4:05 PM, Joshua Cranmer 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"><span class="">On 6/12/17 1:34 AM, Joshua Cranmer 🐧 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If you're dead set on actually printing the name of the class of a Value, there's no canned method to do that. Something like this code would work (untested):<br>
const char *kind_name = nullptr;<br>
switch(val->getValueID()) {<br>
#define HANDLE_VALUE(name) case Value::name##Val: kind_name = #name; break;<br>
default: kind_name = "well this was unexpected";<br>
}<br>
</blockquote>
<br></span>
Arggh, I'm an idiot. The correct code should be:<span class=""><br>
const char *kind_name = nullptr;<br>
switch(val->getValueID()) {<br>
#define HANDLE_VALUE(name) case Value::name##Val: kind_name = #name; break;<br></span>
#include "llvm/IR/Value.def"<br>
#undef HANDLE_VALUE<span class=""><br>
default: kind_name = "well this was unexpected";<br>
}<br>
<br></span>
The #include is kinda the most important part in that statement...<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Joshua Cranmer<br>
Thunderbird module owner<br>
DXR coauthor</font></span><div class="HOEnZb"><div class="h5"><br>
<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>
</div></div></blockquote></div><br></div>