[compiler-rt] 22e66a9 - Revert "[sanitizer] Add a few of type_traits tools"

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 15:46:32 PST 2021


Author: Vitaly Buka
Date: 2021-11-17T15:46:16-08:00
New Revision: 22e66a97cb37b0072c87ab7aced3e6f1be49b126

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

LOG: Revert "[sanitizer] Add a few of type_traits tools"

Does not work with GCC

This reverts commit a82ee2be9c6378cd34deb3ab002d78acd2b04ff3.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_type_traits.h
    compiler-rt/lib/sanitizer_common/tests/sanitizer_type_traits_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_type_traits.h b/compiler-rt/lib/sanitizer_common/sanitizer_type_traits.h
index b5cabb85ce3f0..2a58d9874d2cb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_type_traits.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_type_traits.h
@@ -13,8 +13,6 @@
 #ifndef SANITIZER_TYPE_TRAITS_H
 #define SANITIZER_TYPE_TRAITS_H
 
-#include "sanitizer_common/sanitizer_internal_defs.h"
-
 namespace __sanitizer {
 
 struct true_type {
@@ -59,53 +57,6 @@ struct conditional<false, T, F> {
   using type = F;
 };
 
-template <class T>
-struct remove_reference {
-  using type = T;
-};
-template <class T>
-struct remove_reference<T&> {
-  using type = T;
-};
-template <class T>
-struct remove_reference<T&&> {
-  using type = T;
-};
-
-template <class T>
-WARN_UNUSED_RESULT inline typename remove_reference<T>::type&& move(T&& t) {
-  return static_cast<typename remove_reference<T>::type&&>(t);
-}
-
-template <class T>
-WARN_UNUSED_RESULT inline constexpr T&& forward(
-    typename remove_reference<T>::type& t) {
-  return static_cast<T&&>(t);
-}
-
-template <class T>
-WARN_UNUSED_RESULT inline constexpr T&& forward(
-    typename remove_reference<T>::type&& t) {
-  return static_cast<T&&>(t);
-}
-
-template <class T, T v>
-struct integral_constant {
-  static constexpr const T value = v;
-  typedef T value_type;
-  typedef integral_constant type;
-  constexpr operator value_type() const { return value; }
-  constexpr value_type operator()() const { return value; }
-};
-
-template <class T>
-struct is_trivially_destructible
-    : public integral_constant<bool, __is_trivially_destructible(T)> {};
-
-template <class T>
-struct is_trivially_copyable
-    : public integral_constant<bool, __is_trivially_copyable(T)> {};
-
 }  // namespace __sanitizer
 
 #endif

diff  --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_type_traits_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_type_traits_test.cpp
index d6c3ad4b8661d..40f6e47e526fa 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_type_traits_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_type_traits_test.cpp
@@ -10,13 +10,10 @@
 //
 //===----------------------------------------------------------------------===//
 #include "sanitizer_common/sanitizer_type_traits.h"
-
-#include <vector>
-
 #include "gtest/gtest.h"
 #include "sanitizer_common/sanitizer_internal_defs.h"
 
-namespace __sanitizer {
+using namespace __sanitizer;
 
 TEST(SanitizerCommon, IsSame) {
   ASSERT_TRUE((is_same<unsigned, unsigned>::value));
@@ -33,51 +30,3 @@ TEST(SanitizerCommon, Conditional) {
   ASSERT_TRUE((is_same<int, conditional<true, int, double>::type>::value));
   ASSERT_TRUE((is_same<double, conditional<false, int, double>::type>::value));
 }
-
-TEST(SanitizerCommon, RemoveReference) {
-  ASSERT_TRUE((is_same<int, remove_reference<int>::type>::value));
-  ASSERT_TRUE((is_same<const int, remove_reference<const int>::type>::value));
-  ASSERT_TRUE((is_same<int, remove_reference<int&>::type>::value));
-  ASSERT_TRUE((is_same<const int, remove_reference<const int&>::type>::value));
-  ASSERT_TRUE((is_same<int, remove_reference<int&&>::type>::value));
-}
-
-TEST(SanitizerCommon, Move) {
-  std::vector<int> v = {1, 2, 3};
-  auto v2 = __sanitizer::move(v);
-  EXPECT_EQ(3u, v2.size());
-  EXPECT_TRUE(v.empty());
-}
-
-TEST(SanitizerCommon, Forward) {
-  std::vector<int> v = {1, 2, 3};
-  auto v2 = __sanitizer::forward<std::vector<int>>(v);
-  EXPECT_EQ(3u, v2.size());
-  EXPECT_TRUE(v.empty());
-}
-
-TEST(SanitizerCommon, ForwardConst) {
-  const std::vector<int> v = {1, 2, 3};
-  auto v2 = __sanitizer::forward<const std::vector<int>&>(v);
-  EXPECT_EQ(3u, v2.size());
-  EXPECT_EQ(3u, v.size());
-}
-
-struct TestStruct {
-  int a;
-  float b;
-};
-
-TEST(SanitizerCommon, IsTriviallyDestructible) {
-  ASSERT_TRUE((is_trivially_destructible<int>::value));
-  ASSERT_TRUE((is_trivially_destructible<TestStruct>::value));
-  ASSERT_FALSE((is_trivially_destructible<std::vector<int>>::value));
-}
-
-TEST(SanitizerCommon, IsTriviallyCopyable) {
-  ASSERT_TRUE((is_trivially_copyable<int>::value));
-  ASSERT_TRUE((is_trivially_copyable<TestStruct>::value));
-  ASSERT_FALSE((is_trivially_copyable<std::vector<int>>::value));
-}
-
-}  // namespace __sanitizer
\ No newline at end of file


        


More information about the llvm-commits mailing list