[libcxx-commits] [libcxx] cce1feb - [libc++][NFC] Remove some dead code in string (#94893)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 11 13:58:04 PDT 2024


Author: Nikolas Klauser
Date: 2024-06-11T16:58:00-04:00
New Revision: cce1feb7b1caf6bd5fab311a787481a3f6a9dcdf

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

LOG: [libc++][NFC] Remove some dead code in string (#94893)

It looks like the last references got removed in c747bd0e2339.
It removed a __zero() function, which was probably created at
some point in the ancient past to optimize copying the string 
representation. The __zero() function got simplified to an 
assignment as part of making string constexpr, rendering this 
code unnecessary.

Added: 
    

Modified: 
    libcxx/include/string

Removed: 
    


################################################################################
diff  --git a/libcxx/include/string b/libcxx/include/string
index 5301f8a87d9bb..751af8f1476d0 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -868,23 +868,9 @@ private:
 
   static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
 
-  union __ulx {
-    __long __lx;
-    __short __lxx;
-  };
-
-  enum { __n_words = sizeof(__ulx) / sizeof(size_type) };
-
-  struct __raw {
-    size_type __words[__n_words];
-  };
-
-  struct __rep {
-    union {
-      __short __s;
-      __long __l;
-      __raw __r;
-    };
+  union __rep {
+    __short __s;
+    __long __l;
   };
 
   __compressed_pair<__rep, allocator_type> __r_;


        


More information about the libcxx-commits mailing list