<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 20, 2015, at 10:09 AM, Hui Zhang <<a href="mailto:wayne.huizhang@gmail.com" class="">wayne.huizhang@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Hello,<br class=""><br class=""></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">I'm a little confused about the DIScopeRef ,or other names end with Ref...Why and when shall we use them ?<br class=""><br class=""></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Like StringRef, it has a function str() to change it to normal std::string, but DIScopeRef, its full definition is: <br class=""><pre class=""><span class="">typedef</span> <a class="" href="http://llvm.org/docs/doxygen/html/classllvm_1_1DIRef.html" title="Represents reference to a DIDescriptor.">DIRef<DIScope></a> <a class="" href="http://llvm.org/docs/doxygen/html/namespacellvm.html#ad3fed63164a27d11963083c621293298">DIScopeRef</a><br class=""></pre><pre class="">DIRef: Represents reference to a <a class="" href="http://llvm.org/docs/doxygen/html/classllvm_1_1DIDescriptor.html" title="A thin wraper around MDNode to access encoded debug info.">DIDescriptor</a>. abstracts over direct and identifier-based metadata references. <br clear="all" class=""></pre></div><br class=""><div class="gmail_default" style="font-family:georgia,serif;font-size:large">​Therefore, when I get a DIScopeRef dsf, shall I just treat it just like DIScope ? means I can directly call dsf.func(), where func() represents all the member functions of DIScope, right ??<br class=""></div></div></div></blockquote><div><br class=""></div><div>First of all, DIScopeRef has nothing to do with StringRef. It’s not clear from you question if you want a general answer regarding the latter. For the DIScopeRef part:</div><div><br class=""></div><div>No, you cannot call DIScope methods on a DIScopeRef. DIRef<>s are used to handle uniquing of some DebugInfo IR constructs. The ‘real’ DIScope that’s hidden behind a DIScopeRef can be retrieved using the resolve() method. You can look in DwarfDebug.cpp for places where this is done.</div><div><br class=""></div><div>It would be easier to help you if you stated what you try to achieve. </div><div><br class=""></div><div>Fred</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Thanks​</div><br class="">-- <br class=""><div class="gmail_signature">Best regards<br class=""><br class=""><br class="">Hui Zhang<br class=""></div>
</div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></body></html>