[cfe-commits] [PATCH] StringRef'ize clang::driver::Option::getName()

Zach Wheeler zachw.foss at gmail.com
Mon Jul 4 13:50:47 PDT 2011


I had trouble running the tests at first, but then I figured it out.

In case you don't already know: one test (Driver/hello.c) fails, but does so
with and without this patch applied.

ZJ

On Fri, Jul 1, 2011 at 12:09 PM, Zach Wheeler <zachw.foss at gmail.com> wrote:

> I forgot to initialize NameLen. :-/
>
> I stored 'Name' as start+size because I saw that pattern in
> lib/Basic/DiagnosticID.h, and assumed it was expected. Storing a StringRef
> makes more sense to me. Here's an updated patch. Clang builds successfully,
> and hopefully the tests will pass.
>
> ZJ
>
>
> On Thu, Jun 30, 2011 at 4:04 PM, Chris Lattner <clattner at apple.com> wrote:
>
>>
>> On Jun 30, 2011, at 11:47 AM, Zach Wheeler wrote:
>>
>> > This patch changes the return type of Option::getName() from const char*
>> to StringRef, doing away with the need for several calls to strlen.
>> > Clang builds fine with these changes.
>>
>> THis patch looks reasonable, except that it completely breaks the
>> testsuite :).  Please track down the bug and resubmit a patch.  Also, why
>> not just embed a 'Name' StringRef in Option.h instead of storing the
>> start+size?
>>
>> -Chris
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110704/14c4b459/attachment.html>


More information about the cfe-commits mailing list