[llvm-commits] [PATCH] New Path API design.

Michael Spencer bigcheesegs at gmail.com
Tue Nov 23 14:56:30 PST 2010


On Tue, Nov 23, 2010 at 4:55 PM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
>
> On 23.11.2010, at 22:18, Michael Spencer wrote:
>
>> Attached are two patches. The first adds a new unit-test SystemTests
>> which has the TimeValue test and a new (empty) path test. The second
>> adds include/llvm/System/PathV2.h with documentation and the
>> modifications you mentioned.
>
>> error_code root_name(const Twine &path, StringRef &result);
>
> To get the contents of a Twine it has to be rendered to a buffer. Unless we have a global buffer
> (and a lot of thread safety issues) we can't return a StringRef to that buffer.

Hmm, you're right. That was originally a StringRef, but I did a search
and replace with Twine. I think I'll change the functions with
StringRef &result to take StringRef path. The other option is to use
even more memory, when the common case would allow returning a
StringRef into path.

- Michael Spencer



More information about the llvm-commits mailing list