Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++][ASan] Fix std::basic_string trait type #91590

Merged
merged 1 commit into from
May 9, 2024

Conversation

AdvenamTacet
Copy link
Member

@AdvenamTacet AdvenamTacet commented May 9, 2024

Addresses the comment: #79536 (comment)

Changes the type to void instead of false_type.

The value is used here:

template <class _Tp>
struct __libcpp_is_trivially_relocatable<_Tp,
__enable_if_t<is_same<_Tp, typename _Tp::__trivially_relocatable>::value> >
: true_type {};

@AdvenamTacet AdvenamTacet requested a review from a team as a code owner May 9, 2024 13:23
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 9, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 9, 2024

@llvm/pr-subscribers-libcxx

Author: Tacet (AdvenamTacet)

Changes

Addresses comment: #79536 (comment)

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


Full diff: https://github.com/llvm/llvm-project/pull/91590.diff

1 Files Affected:

  • (modified) libcxx/include/string (+2-2)
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,

@AdvenamTacet AdvenamTacet merged commit 6c83565 into llvm:main May 9, 2024
53 checks passed
@AdvenamTacet AdvenamTacet deleted the asan-traits-fix branch May 9, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants