r174263 - libclang: introduce cxstring::{createRef, createDup} for StringRefs
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Feb 19 05:50:28 PST 2013
On Tue, Feb 19, 2013 at 5:12 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Tue, Feb 19, 2013 at 1:58 PM, Evgeniy Stepanov
> <eugeni.stepanov at gmail.com> wrote:
>> the code at CXString.cpp:85 does not look good at all. It reads 1 byte
>> past the end of the string, which may belong to a different
>> allocation, and, after some time, that '\0' may not be there anymore!
>
> I know. This commit just refactors the code without making any
> functionality changes. Removing this check and copying the string
> unconditionally will introduce a performance hit that can be avoided.
>
> I am working on a patch that fixes this, will submit it soon. It
> introduces a new class, StringRefNulTerminated, that is derived from
> StringRef, to explicitly mark nul-terminated strings in the type
> system. I would appreciate your comments on this patch.
Sorry, I did not notice that this code was there before.
What you are doing sounds like a big, but necessary change. Feel free
to cc: me on that patch when it's ready for review.
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list