<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 28, 2016 at 11:44 AM, Eugene Leviant <span dir="ltr"><<a href="mailto:evgeny.leviant@gmail.com" target="_blank">evgeny.leviant@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">evgeny777 added a comment.<br>
<br>
I have Sectio<br>
<span class=""><br>
<br>
<br>
================<br>
Comment at: include/llvm/Object/<wbr>ELFObjectFile.h:99-101<br>
</span><span class="">+  static inline bool classof(const SectionRef *v) {<br>
+    return v->getObject()->isELF();<br>
+  }<br>
</span>----------------<br>
<span class="">ruiu wrote:<br>
> Why do you want this?<br>
</span>I have SectionRef object and I want to get section offset, which is ELF section property.<br>
With this I can write:<br>
<br>
```<br>
cast<ELFSectionRef>(S)-><wbr>getOffset();<br>
```<br>
Without it I have to use this one:<br>
```<br>
cast<ELFObjectFileBase>(S-><wbr>getObject())-><wbr>getSectionOffset(S-><wbr>getRawDataRefImpl());<br>
```</blockquote><div><br></div><div>If you add classof to one derived class, you want to define classof for all derived classes, otherwise it won't work. If you already know the type of an object, you can just do static_cast<>, can't you?</div></div></div></div>