Files
allwpilib/upstream_utils/llvm_patches/0023-Add-convienence-feature-to-SmallString.patch
Tyler Veness 44abc8dfa6 [upstream_utils] Remove git version from upstream patches (#4351)
This reduces commit noise when other git versions are used. The version
was removed by passing `--no-signature` to `git format-patch` which is
now documented in the readme.
2022-08-13 18:31:26 -07:00

29 lines
1.0 KiB
Diff

From 333f987aa17d7138af8bf6e41d5749041793a721 Mon Sep 17 00:00:00 2001
From: PJ Reiniger <pj.reiniger@gmail.com>
Date: Mon, 9 May 2022 00:18:29 -0400
Subject: [PATCH 23/27] Add convienence feature to SmallString
---
llvm/include/llvm/ADT/SmallString.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h
index 85987811f3c4..d3d469d45d15 100644
--- a/llvm/include/llvm/ADT/SmallString.h
+++ b/llvm/include/llvm/ADT/SmallString.h
@@ -188,9 +188,11 @@ public:
/// Implicit conversion to std::string_view.
operator std::string_view() const { return str(); }
- explicit operator std::string() const {
- return std::string(this->data(), this->size());
- }
+ /// Explicit conversion to std::string.
+ std::string string() const { return {this->begin(), this->size()}; }
+
+ /// Implicit conversion to std::string.
+ operator std::string() const { return string(); }
// Extra operators.
SmallString &operator=(std::string_view RHS) {