[libcxx-commits] [libcxx] [libc++][ASan] Fix std::basic_string trait type (PR #91590)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 9 06:23:33 PDT 2024


https://github.com/AdvenamTacet created https://github.com/llvm/llvm-project/pull/91590

Addresses comment: https://github.com/llvm/llvm-project/pull/79536#discussion_r1593652240

Changes type to `void` instead of `false_type`.

The value is used here:

https://github.com/llvm/llvm-project/blob/main/libcxx/include/__type_traits/is_trivially_relocatable.h#L35-L38

>From c2bae20971a3148dcd64d7ef235366d5b1847bd4 Mon Sep 17 00:00:00 2001
From: Advenam Tacet <advenam.tacet at trailofbits.com>
Date: Thu, 9 May 2024 15:17:44 +0200
Subject: [PATCH] [libc++][ASan] Fix std::basic_string trait type

Addresses comment: https://github.com/llvm/llvm-project/pull/79536#discussion_r1593652240

Changes type to `void` instead of `false_type`.

The value is used here:

https://github.com/llvm/llvm-project/blob/main/libcxx/include/__type_traits/is_trivially_relocatable.h#L35-L38
---
 libcxx/include/string | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/string b/libcxx/include/string
index 8f629d8bf13c8..1db803e822d72 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -741,8 +741,8 @@ public:
   // is kept inside objects memory (short string optimization), instead of in allocated
   // external memory. In such cases, the destructor is responsible for unpoisoning
   // the memory to avoid triggering false positives.
-  // Therefore it's crucial to ensure the destructor is called
-  using __trivially_relocatable = false_type;
+  // Therefore it's crucial to ensure the destructor is called.
+  using __trivially_relocatable = void;
 #else
   using __trivially_relocatable = __conditional_t<
       __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value,



More information about the libcxx-commits mailing list