<div dir="ltr">Hi Hans,<div><br></div><div>Thanks for the reply. I apologize for the unclear question. I am new to using clang and llvm.</div><div><br></div><div>I have tried this but the version I have for some reason won't allow me to use this command line option. Furthermore, I am trying to get this information via the IR and writing a pass to get this information to use at a later point.</div><div><br></div><div><br></div><div>-Dami </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 30, 2017 at 12:56 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Damilola,<br>
<span class=""><br>
On Mon, May 29, 2017 at 5:20 AM, Damilola Orikogbo via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Can someone help me with how to dump the vtable and the vptr addresses<br>
> within it?<br>
<br>
</span>I'm not sure if this answers your question exactly, but you can pass<br>
"-Xclang -fdump-vtable-layouts" to ask Clang to dump the layout of<br>
generated vtables. For example:<br>
<br>
$ cat /tmp/a.cc<br>
struct S {<br>
virtual void f() {};<br>
};<br>
<br>
void f(S * s) {<br>
s->f();<br>
}<br>
$ bin/clang++ -c /tmp/a.cc -Xclang -fdump-vtable-layouts<br>
Vtable for 'S' (3 entries).<br>
0 | offset_to_top (0)<br>
1 | S RTTI<br>
-- (S, 0) vtable address --<br>
2 | void S::f()<br>
<br>
VTable indices for 'S' (1 entries).<br>
0 | void S::f()<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
- Hans<br>
</font></span></blockquote></div><br></div>