<div dir="auto">Thank you eli, my bad will take care that next time. </div><div class="gmail_extra"><br><div class="gmail_quote">On Dec 21, 2016 11:34 PM, "Friedman, Eli" <<a href="mailto:efriedma@codeaurora.org">efriedma@codeaurora.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="m_1150290280364810728moz-cite-prefix">On 12/21/2016 5:01 AM, Umesh Kalappa
via llvm-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>To context was ,</div>
<div><br>
</div>
Basic requirement was to append extra string to the decl name
and update all his references to the updated name. ,
<div><br>
</div>
<div>So we are constructing the DeclarationName instance as
stated below code snap.</div>
<div>and from DeclarationName instance ,we are constructing the
DeclarationNameInfo and same info used to create decl spec
with FunctionDecl::Create () .</div>
<div><br>
</div>
<div>Question is ,</div>
<div><br>
</div>
<div>How do ,someone instantiate the DeclarationName instance
using StringRef ,because in the current trunk code snap ,we
see that the DeclarationName can be constructed using the
IdentifierInfo or Objc Selector or CXXOperatorId etc as
argument in the constructor .</div>
<div><br>
</div>
<div>The code i.e</div>
<div> </div>
<div>
<div>void appendExtern(StringRef Sr)</div>
<div>{</div>
<div> char *ExternChar = const_cast<char *> (Sr.data());<br>
</div>
<div>
<div> *Ptr =reinterpret_cast<void *>(ExternChar);</div>
<div> </div>
<div> this->ExternName = DeclarationName::getFromOpaque<wbr>Ptr(Ptr);</div>
</div>
<div><br>
</div>
<div>}</div>
</div>
<div><br>
</div>
<div>the above is kind of hack ,may result in dangling memory
references ,Any thoughts on this ?<br>
</div>
<div><br>
</div>
<div>we thought to change the DeclarationName class ,with adding
new DeclarationName constructor ,that construct
the DeclarationName instance by StringRef as argument.
i.e DeclarationName(StringRef Sr) ;</div>
<div><br>
</div>
<div>Before doing this ,we thought to check with community for
better alternative / suggestions .</div>
<br>
</div>
</blockquote>
<br>
Usually it's better to send questions about the clang frontend to
just cfe-dev, rather than llvm-dev.<br>
<p>You can use IdentifierTable::get to get an IdentifierInfo for an
arbitrary string, then make a DeclarationName from that.</p>
<p>-Eli<br>
</p>
<pre class="m_1150290280364810728moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</div>
</blockquote></div></div>