[Lldb-commits] [PATCH] D65942: Disallow implicit conversion from pointers to bool in llvm::toStringRef

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 9 01:00:27 PDT 2019


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

It seems everybody agrees that this is the way forward.



================
Comment at: llvm/include/llvm/ADT/StringExtras.h:52-53
 /// Construct a string ref from a boolean.
-inline StringRef toStringRef(bool B) { return StringRef(B ? "true" : "false"); }
+template <typename T>
+typename std::enable_if<std::is_same<T, bool>::value, StringRef>::type
+toStringRef(T B) {
----------------
This enable_if trick might be worth a short comment...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65942/new/

https://reviews.llvm.org/D65942





More information about the lldb-commits mailing list