diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-07-25 23:06:39 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-07-25 23:06:39 +0000 |
commit | fb5b3eaacbc65603b436279300c32512176150fe (patch) | |
tree | 859f50599316a16d71004e66f2800434ad203828 /include/llvm/ADT | |
parent | 36e6ae6106fe3cd4892ae451fa75db9c2b6ac40f (diff) | |
download | external_llvm-fb5b3eaacbc65603b436279300c32512176150fe.zip external_llvm-fb5b3eaacbc65603b436279300c32512176150fe.tar.gz external_llvm-fb5b3eaacbc65603b436279300c32512176150fe.tar.bz2 |
Add a bool->StringRef c'tor to StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/StringRef.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index d013d05..56848fb 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -90,6 +90,10 @@ namespace llvm { /*implicit*/ StringRef(const std::string &Str) : Data(Str.data()), Length(Str.length()) {} + /// Construct a string ref from a boolean. + explicit StringRef(bool B) + : Data(B ? "true" : "false"), Length(::strlen(Data)) {} + /// @} /// @name Iterators /// @{ |