summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/StringRef.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index d013d05623..56848fb616 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
/// @{