[cfe-commits] [PATCH] StringRef'ize API: clang::Token::getName()
rjmccall at apple.com
Mon Jun 27 19:32:41 PDT 2011
On Jun 27, 2011, at 5:14 PM, Chris Lattner wrote:
> On Jun 25, 2011, at 2:55 PM, Zach Wheeler wrote:
>> This patch is intended to change clang::Token::getName() so that it returns llvm::StringRef instead of const char*.
>> This is my first patch (ever), so if I did something I wasn't supposed to, just scream at me and I'll try to fix it. :-)
>> This turned out to be an easy place to start; the doxygen reference indicates that this method isn't referenced at all. Clang built fine with these changes.
> Hi Zach,
> This is a great start, but I'd prefer to not change these: if they aren't called at all, please send in a patch to nuke them :). Also, since these are just returning constant C strings, a "const char*" is actually good enough.
Surely all of the callers of getName() would have to do an unnecessary strlen here? Granted that there aren't any. :) But if we weren't nuking the calls, I don't see why converting them to return StringRef wouldn't be an improvement.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits