[llvm] 5abbe8e - Revert "[ADT] Add std::string_view conversion to SmallString (#83397)"

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 13:14:45 PST 2024


Author: Aiden Grossman
Date: 2024-02-29T13:14:39-08:00
New Revision: 5abbe8ec9edcc034fad383ab69046e8c0d13c97d

URL: https://github.com/llvm/llvm-project/commit/5abbe8ec9edcc034fad383ab69046e8c0d13c97d
DIFF: https://github.com/llvm/llvm-project/commit/5abbe8ec9edcc034fad383ab69046e8c0d13c97d.diff

LOG: Revert "[ADT] Add std::string_view conversion to SmallString (#83397)"

This reverts commit cff36bb198759c4fe557adc594eabc097cf7d565.

This patch was causing build failures in certain configurations.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/SmallString.h
    llvm/unittests/ADT/SmallStringTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h
index ab5d483558cac8..a5b9eec50c8257 100644
--- a/llvm/include/llvm/ADT/SmallString.h
+++ b/llvm/include/llvm/ADT/SmallString.h
@@ -265,11 +265,6 @@ class SmallString : public SmallVector<char, InternalLen> {
   /// Implicit conversion to StringRef.
   operator StringRef() const { return str(); }
 
-  /// Implicit conversion to std::string_view.
-  operator std::string_view() const {
-    return std::string_view(this->data(), this->size());
-  }
-
   explicit operator std::string() const {
     return std::string(this->data(), this->size());
   }

diff  --git a/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp
index d68d73157988ab..2f4df8afeafa59 100644
--- a/llvm/unittests/ADT/SmallStringTest.cpp
+++ b/llvm/unittests/ADT/SmallStringTest.cpp
@@ -244,10 +244,4 @@ TEST_F(SmallStringTest, GTestPrinter) {
   EXPECT_EQ(R"("foo")", ::testing::PrintToString(ErasedSmallString));
 }
 
-TEST_F(SmallStringTest, StringView) {
-  theString = "hello from std::string_view";
-  EXPECT_EQ("hello from std::string_view",
-            static_cast<std::string_view>(theString));
-}
-
 } // namespace


        


More information about the llvm-commits mailing list