[llvm] r187166 - Add a bool->StringRef c'tor to StringRef.

Bill Wendling isanbard at gmail.com
Fri Jul 26 11:35:03 PDT 2013


On Jul 26, 2013, at 11:31 AM, David Blaikie <dblaikie at gmail.com> wrote:

> On Thu, Jul 25, 2013 at 4:06 PM, Bill Wendling <isanbard at gmail.com> wrote:
>> Author: void
>> Date: Thu Jul 25 18:06:39 2013
>> New Revision: 187166
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=187166&view=rev
>> Log:
>> Add a bool->StringRef c'tor to StringRef.
> 
> FWIW I was more expecting this to be a free function - not sure it
> really deserves to be a StringRef ctor, even if it's explicit. Would
> make the usage of this a little bit subtle. A "toString" or something
> might be a bit more legible.
> 
> Not going to make any absolute claims here, so do whatever you think
> is best - just thoughts.
> 
Do you mean something like this?

StringRef boolToStringRef(bool B) {
  return StringRef(B ? "true" : "false");
}

-bw




More information about the llvm-commits mailing list