[libcxx-commits] [libcxx] [libc++][Android] Allow testing libc++ with clang-r536225 (PR #116149)

Ryan Prichard via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 18 14:53:42 PST 2024


https://github.com/rprichard updated https://github.com/llvm/llvm-project/pull/116149

>From 4a4fd53dc4b8fbc799921e4e95cfc913ca25203c Mon Sep 17 00:00:00 2001
From: Ryan Prichard <rprichard at google.com>
Date: Wed, 13 Nov 2024 18:25:52 -0800
Subject: [PATCH 1/4] [libc++][Android] Allow testing libc++ with clang-r536225

The Android clang-r536225 compiler identifies as Clang 19, but it is based
on commit fc57f88f007497a4ead0ec8607ac66e1847b02d6, which predates the
official LLVM 19.0.0 release.

Some tests need fixes:

 * The sized delete tests fail because clang-r536225 leaves sized
   deallocation off by default.

 * std::array<T[0]> is true when this Android Clang version is used with
   a trunk libc++, but we expect it to be false in the test. In practice,
   Clang and libc++ usually come from the same commit on Android.
---
 .../new.delete.array/sized_delete_array14.pass.cpp        | 4 ++++
 .../new.delete/new.delete.single/sized_delete14.pass.cpp  | 4 ++++
 .../meta/meta.unary/meta.unary.cat/is_array.pass.cpp      | 8 ++++++++
 3 files changed, 16 insertions(+)

diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index 85b641322d99e3..f2504a09ac8ab5 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -11,6 +11,10 @@
 // These compiler versions don't enable sized deallocation by default.
 // UNSUPPORTED: clang-17, clang-18
 
+// Android clang-r536225 identifies as clang-19 but it predates the real
+// LLVM 19.0.0, so it also leaves sized deallocation off by default.
+// UNSUPPORTED: android && clang-19
+
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
 // XFAIL: apple-clang
 // XFAIL: using-built-library-before-llvm-11
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index ae614a1432f7db..2d45283c225426 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -11,6 +11,10 @@
 // These compiler versions do not enable sized deallocation by default.
 // UNSUPPORTED: clang-17, clang-18
 
+// Android clang-r536225 identifies as clang-19 but it predates the real
+// LLVM 19.0.0, so it also leaves sized deallocation off by default.
+// UNSUPPORTED: android && clang-19
+
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
 // XFAIL: apple-clang
 // XFAIL: using-built-library-before-llvm-11
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
index 26a469a30515af..d42e00c878e945 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
@@ -73,7 +73,15 @@ typedef void (*FunctionPtr)();
 int main(int, char**)
 {
     test_is_array<char[3]>();
+    // Android clang-r536225 identifies as clang-19, but it predates the
+    // LLVM 19.0.0 release. It lacks llvm.org/pr86652, which changed __is_array
+    // to return false for T[0]. llvm.org/pr93037 relies on that change for
+    // correct handling of std::is_array<T[0]>. This test will pass as long as
+    // Clang and libc++ come from the same LLVM commit, but we can't detect that
+    // here.
+#if !defined(__ANDROID__) || __clang_major__ != 19
     test_is_not_array<char[0]>();
+#endif
     test_is_array<char[]>();
     test_is_array<Union[]>();
 

>From 37ba94bf11cb2f8d89b65d4bf4af9ae098be25c5 Mon Sep 17 00:00:00 2001
From: Ryan Prichard <rprichard at google.com>
Date: Thu, 14 Nov 2024 14:22:51 -0800
Subject: [PATCH 2/4] clang-19.1 and newer clang-19 versions *are* new enough
 to run the tests

---
 .../new.delete/new.delete.array/sized_delete_array14.pass.cpp | 4 ++--
 .../new.delete/new.delete.single/sized_delete14.pass.cpp      | 4 ++--
 .../meta/meta.unary/meta.unary.cat/is_array.pass.cpp          | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index f2504a09ac8ab5..52c4e3e0f69b69 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -11,9 +11,9 @@
 // These compiler versions don't enable sized deallocation by default.
 // UNSUPPORTED: clang-17, clang-18
 
-// Android clang-r536225 identifies as clang-19 but it predates the real
+// Android clang-r536225 identifies as clang-19.0 but it predates the real
 // LLVM 19.0.0, so it also leaves sized deallocation off by default.
-// UNSUPPORTED: android && clang-19
+// UNSUPPORTED: android && clang-19.0
 
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
 // XFAIL: apple-clang
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index 2d45283c225426..e00339761ec24c 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -11,9 +11,9 @@
 // These compiler versions do not enable sized deallocation by default.
 // UNSUPPORTED: clang-17, clang-18
 
-// Android clang-r536225 identifies as clang-19 but it predates the real
+// Android clang-r536225 identifies as clang-19.0 but it predates the real
 // LLVM 19.0.0, so it also leaves sized deallocation off by default.
-// UNSUPPORTED: android && clang-19
+// UNSUPPORTED: android && clang-19.0
 
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
 // XFAIL: apple-clang
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
index d42e00c878e945..f18dfe6d403097 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
@@ -79,7 +79,7 @@ int main(int, char**)
     // correct handling of std::is_array<T[0]>. This test will pass as long as
     // Clang and libc++ come from the same LLVM commit, but we can't detect that
     // here.
-#if !defined(__ANDROID__) || __clang_major__ != 19
+#if !defined(__ANDROID__) || __clang_major__ != 19 || __clang_minor__ != 0
     test_is_not_array<char[0]>();
 #endif
     test_is_array<char[]>();

>From 17f7c0b0e616f99087e4a4d93a5fc63ae4b85e83 Mon Sep 17 00:00:00 2001
From: Ryan Prichard <rprichard at google.com>
Date: Thu, 14 Nov 2024 14:48:04 -0800
Subject: [PATCH 3/4] clang-19 to clang-19.0 in comment, for consistency

---
 .../utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
index f18dfe6d403097..d72933088ff2fd 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
@@ -73,7 +73,7 @@ typedef void (*FunctionPtr)();
 int main(int, char**)
 {
     test_is_array<char[3]>();
-    // Android clang-r536225 identifies as clang-19, but it predates the
+    // Android clang-r536225 identifies as clang-19.0, but it predates the
     // LLVM 19.0.0 release. It lacks llvm.org/pr86652, which changed __is_array
     // to return false for T[0]. llvm.org/pr93037 relies on that change for
     // correct handling of std::is_array<T[0]>. This test will pass as long as

>From e001176b12f50e4e7b3e1b28d17c4529346656be Mon Sep 17 00:00:00 2001
From: Ryan Prichard <rprichard at google.com>
Date: Fri, 15 Nov 2024 16:12:42 -0800
Subject: [PATCH 4/4] switch from __clang_major__/__clang_minor__ to
 TEST_CLANG_VER

---
 .../utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
index d72933088ff2fd..f48c2ccb591516 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
@@ -79,7 +79,7 @@ int main(int, char**)
     // correct handling of std::is_array<T[0]>. This test will pass as long as
     // Clang and libc++ come from the same LLVM commit, but we can't detect that
     // here.
-#if !defined(__ANDROID__) || __clang_major__ != 19 || __clang_minor__ != 0
+#if !defined(__ANDROID__) || TEST_CLANG_VER != 1900
     test_is_not_array<char[0]>();
 #endif
     test_is_array<char[]>();



More information about the libcxx-commits mailing list