[cfe-dev] CIndex changes

steve naroff snaroff at apple.com
Fri Nov 6 10:24:47 PST 2009


On Nov 6, 2009, at 12:34 PM, John Thompson wrote:

> Hi,
>
> What's the status of this issue?  (CIndex string returns clobbered)
> From purely a programming point of view, I still think changing the  
> API for these functions to have the user pass in a string buffer and  
> max length and then return the buffer pointer seems the most  
> reasonable thing to do.  But I don't know the extent of your client  
> impact, which I presume is the reason for the reluctance to change  
> the API
>

Hi John,

Since these are new API's, the client impact isn't that big a concern.

There is no doubt that having the client allocate the buffer is the  
simplest solution. My concern is making the API inconvenient.

I will make a decision on this within the hour:-)

Thanks for the follow-up...

snaroff

> -John
> On Wed, Oct 28, 2009 at 4:46 AM, steve naroff <snaroff at apple.com>  
> wrote:
>
> On Oct 27, 2009, at 7:59 PM, Ted Kremenek wrote:
>
>> Thanks John.  The patch makes it very clear.
>>
>> The problem is that we don't want to add static data to CIndex, as  
>> we want the functions to be as reentrant as possible.
>>
>> Steve/Doug: I believe you guys discussed this one.  Comments?
>>
>
> Hey Ted,
>
> We haven't discussed it yet. I expect to speak with Doug today/ 
> tomorrow and make a decision by the end of the week.
>
> snaroff
>
>> On Oct 27, 2009, at 2:51 PM, John Thompson wrote:
>>
>>> Thanks, Ted.
>>>
>>> I'm sorry I've been disconnected from this.  What particular code  
>>> were you looking at that returned a 'const char*' that referred to  
>>> the buffer associated with a temporary std::string?
>>> It's in clang_getTranslationUnitSpelling, clang_getDeclSpelling,  
>>> and clang_getCursorSpelling.  The enclosed patch with my hacky  
>>> work-around will show the specific places.
>>>
>>> I also moved getLocationFromCursor to fix a VC++ message about the  
>>> return type not being permitted inside an extern "C" {} block.
>>> -John
>>>
>>> -- 
>>> John Thompson
>>> John.Thompson.JTSoftware at gmail.com
>>>
>>> < 
>>> cindex_strings.patch>_______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>
>
>
> -- 
> John Thompson
> John.Thompson.JTSoftware at gmail.com
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091106/6e9f456f/attachment.html>


More information about the cfe-dev mailing list