r174263 - libclang: introduce cxstring::{createRef, createDup} for StringRefs
Dmitri Gribenko
gribozavr at gmail.com
Tue Feb 19 05:12:43 PST 2013
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.
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