<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::<wbr>getFromOpaquePtr(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><div><br></div><div><br></div><div>Thank you </div><div>~Umesh<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 21, 2016 at 4:34 PM, Umesh Kalappa <span dir="ltr"><<a href="mailto:umesh.kalappa0@gmail.com" target="_blank">umesh.kalappa0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Guys ,<div><br></div><div>We have the function that accepts StringRef and construct the DeclarationName instance .</div><div><br></div><div>Currenlty we are achieving the same as ,the code snap</div><div><br></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::<wbr>getFromOpaquePtr(Ptr);</div></div><div><br></div><div>}</div><div><br></div><div>There is, any better way of achieving this  ,because the above code is crashing intermittently ? </div><div><br></div><div>Thank you  and any help here appreciated.</div><span class="gmail-HOEnZb"><font color="#888888"><div>~Umesh</div><div><br></div><div><br></div></font></span></div>
</blockquote></div><br></div></div></div>