[libcxx-commits] [libcxx] [libcxx][test] Remove XFAIL:msvc for no_unique_address in tests (PR #67849)

Caslyn Tonelli via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 2 13:39:55 PDT 2023


https://github.com/Caslyn updated https://github.com/llvm/llvm-project/pull/67849

>From b92b950295e94ba23bfd36c906980b8e0f88c91f Mon Sep 17 00:00:00 2001
From: Caslyn Tonelli <caslyn at google.com>
Date: Fri, 29 Sep 2023 20:19:51 +0000
Subject: [PATCH] [libcxx][test] Add msvc-no-unique-address feature, used by
 tests

This PR introduces the `msvc-no-unique-address` feature, to be used in
no_unique_address.compile.pass.cpp tests.

Since PR 67199 implements the [[msvc::no_unique_address]] attribute,
these tests pass in a windows-x64 build against ToT clang-cl:

```
********************
Unexpectedly Passed Tests (3):
llvm-libc++-static-clangcl.cfg.in :: libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp
llvm-libc++-static-clangcl.cfg.in :: libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp
llvm-libc++-static-clangcl.cfg.in :: libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp
```
---
 .../range.lazy.split/no_unique_address.compile.pass.cpp   | 4 +---
 .../range.split/no_unique_address.compile.pass.cpp        | 4 +---
 .../range.istream.view/no_unique_address.compile.pass.cpp | 4 +---
 libcxx/utils/libcxx/test/features.py                      | 8 ++++++++
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp
index 2918d4f86afb5ae..844a4c628fbf0b2 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp
@@ -7,9 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-
-// clang-cl and cl currently don't support [[no_unique_address]]
-// XFAIL: msvc
+// XFAIL: msvc && !msvc-no-unique-address
 
 // class lazy_split_view {
 //   _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp
index c04dbd7ac0d6959..b73cf417d29215c 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp
@@ -7,9 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-
-// clang-cl and cl currently don't support [[no_unique_address]]
-// XFAIL: msvc
+// XFAIL: msvc && !msvc-no-unique-address
 
 // class split_view {
 //   _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
diff --git a/libcxx/test/libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp
index f2fd2d628bc1dca..4a279558c6216df 100644
--- a/libcxx/test/libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp
+++ b/libcxx/test/libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp
@@ -8,9 +8,7 @@
 
 // UNSUPPORTED: no-localization
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-
-// clang-cl and cl currently don't support [[no_unique_address]]
-// XFAIL: msvc
+// XFAIL: msvc && !msvc-no-unique-address
 
 // Test the libc++ extension that the value stored in `std::ranges::istream_view` has been marked
 // as _LIBCPP_NO_UNIQUE_ADDRESS
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 3779af1094d5d0f..001b30451f87a3b 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -279,6 +279,14 @@ def _getSuitableClangTidy(cfg):
     Feature(name="msvc", when=_isMSVC),
     Feature(name=lambda cfg: "msvc-{}".format(*_msvcVersion(cfg)), when=_isMSVC),
     Feature(name=lambda cfg: "msvc-{}.{}".format(*_msvcVersion(cfg)), when=_isMSVC),
+    Feature(
+        name="msvc-no-unique-address", when=lambda cfg: sourceBuilds(
+          cfg,
+          """
+          struct A { [[msvc::no_unique_address]] A a; };
+          """,
+        ),
+    ),
 ]
 
 # Deduce and add the test features that that are implied by the #defines in



More information about the libcxx-commits mailing list