[libcxx-commits] [libcxx] 4ee747f - [libc++][test] Don't use `__libcpp_is_constant_evaluated` in tests (#72226)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 14 03:05:01 PST 2023


Author: S. B. Tam
Date: 2023-11-14T19:04:57+08:00
New Revision: 4ee747f8d365414dfae03485d93014c9f69cc2af

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

LOG: [libc++][test] Don't use `__libcpp_is_constant_evaluated` in tests (#72226)

Added: 
    

Modified: 
    libcxx/test/support/asan_testing.h
    libcxx/test/support/min_allocator.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/support/asan_testing.h b/libcxx/test/support/asan_testing.h
index 759956ba687b46c..5d044374044dea7 100644
--- a/libcxx/test/support/asan_testing.h
+++ b/libcxx/test/support/asan_testing.h
@@ -19,7 +19,7 @@ extern "C" int __sanitizer_verify_contiguous_container
 template <typename T, typename Alloc>
 TEST_CONSTEXPR bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c )
 {
-    if (std::__libcpp_is_constant_evaluated())
+    if (TEST_IS_CONSTANT_EVALUATED)
         return true;
     if (std::is_same<Alloc, std::allocator<T> >::value && c.data() != NULL)
         return __sanitizer_verify_contiguous_container(

diff  --git a/libcxx/test/support/min_allocator.h b/libcxx/test/support/min_allocator.h
index 1b3727af8185c61..13ee98289c36b7a 100644
--- a/libcxx/test/support/min_allocator.h
+++ b/libcxx/test/support/min_allocator.h
@@ -464,14 +464,14 @@ class safe_allocator {
 
   TEST_CONSTEXPR_CXX20 T* allocate(std::size_t n) {
     T* memory = std::allocator<T>().allocate(n);
-    if (!std::__libcpp_is_constant_evaluated())
+    if (!TEST_IS_CONSTANT_EVALUATED)
       std::memset(memory, 0, sizeof(T) * n);
 
     return memory;
   }
 
   TEST_CONSTEXPR_CXX20 void deallocate(T* p, std::size_t n) {
-    if (!std::__libcpp_is_constant_evaluated())
+    if (!TEST_IS_CONSTANT_EVALUATED)
       DoNotOptimize(std::memset(p, 0, sizeof(T) * n));
     std::allocator<T>().deallocate(p, n);
   }


        


More information about the libcxx-commits mailing list