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

Zach Wheeler zachw.foss at gmail.com
Fri Jul 1 09:09:04 PDT 2011


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/20110701/782f855a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StringRef-ize--driver.Option.getName-2.patch
Type: application/octet-stream
Size: 5034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110701/782f855a/attachment.obj>


More information about the cfe-commits mailing list