<div>Here's my stab at the CXString conversion.</div>
<div> </div>
<div>I also moved getLocationFromCursor to fix a compiler warning.<br></div>
<div>-John<br></div>
<div class="gmail_quote">On Fri, Nov 6, 2009 at 3:27 PM, John Thompson <span dir="ltr"><<a href="mailto:john.thompson.jtsoftware@gmail.com">john.thompson.jtsoftware@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Sure, I'll take a crack at it.</div>
<div> </div>
<div>-John<br><br></div>
<div>
<div></div>
<div class="h5">
<div class="gmail_quote">On Fri, Nov 6, 2009 at 11:14 AM, steve naroff <span dir="ltr"><<a href="mailto:snaroff@apple.com" target="_blank">snaroff@apple.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi John,<br><br>I just spoke with Doug about this and we came up with the following proposal...<br><br>The following API would now return a CXString;<br>
<br>CINDEX_LINKAGE CXString clang_getDeclSpelling(CXDecl);<br><br>The interface to CXString would be:<br><br>const char *clang_getCString(CXString);<br>void clang_disposeString(CXString); /* client must always call this when it no longer needs the string */<br>
<br>The implementation of CXString would be:<br><br>/* Note that both of these slots are effectively 'private' */<br>typedef struct {<br> const char *Spelling;<br> /* A 1 value indicates the clang_ indexing API needed to allocate the string (and it must be freed by clang_disposeString()). */<br>
 int MustFreeString;<br>} CXString;<br><br>The benefit of this abstraction is we can use it in other places if necessary (when dealing with string lifetime issues that cross the C/C++ language barrier).<br><br>What do you (or others interested in this) think? From my perspective, it seems cleaner than the other proposals that have been discussed.<br>
<br>If we can agree on the change, are you interested in making this change?<br><br>Thanks much,<br><br>snaroff<br><br><br><br><br></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>John Thompson<br>
<a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a><br><br></font></blockquote></div><br><br clear="all"><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br>
<br>