Skip to content

Commit ca22113

Browse files
committed
[cxx-interop] Add llvm-lit feature 'std_span'
This adds a check in CMake for whether the current C++ stdlib contains the 'span' header. If so, the llvm-lit feature 'std_span' is set. Also adds 'REQUIRES: std_span' to interop tests that include 'span'. This means we no longer have to choose between blanket disabling `std::span` tests on all Linux distributions, or listing every Linux distro with a libstdc++ version without `std::span` support as unsupported. rdar://161999160 rdar://161999174 rdar://162106580 rdar://162106619 rdar://162106643 rdar://162106653 rdar://162106722 rdar://162106747
1 parent ed647a4 commit ca22113

14 files changed

+18
-6
lines changed

test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ if(NOT "${COVERAGE_DB}" STREQUAL "")
370370
COMMENT "Touching covering tests")
371371
endif()
372372

373+
include(CheckIncludeFileCXX)
374+
check_include_file_cxx("span" HAVE_STD_SPAN)
375+
373376
foreach(SDK ${SWIFT_SDKS})
374377
foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
375378
# macCatalyst needs to run two sets of tests: one with the normal macosx target triple

test/Interop/Cxx/class/access/swiftify-private-fileid.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// RUN: %target-swift-frontend -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -enable-experimental-feature SafeInteropWrappers -verify
55

66
// REQUIRES: swift_feature_SafeInteropWrappers
7+
// REQUIRES: std_span
78

89
//--- Inputs/swiftify-non-public.h
910
#pragma once

test/Interop/Cxx/class/safe-interop-mode.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// REQUIRES: objc_interop
77
// REQUIRES: swift_feature_LifetimeDependence
8+
// REQUIRES: std_span
89

910
//--- Inputs/module.modulemap
1011
module Test {

test/Interop/Cxx/stdlib/std-span-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// REQUIRES: swift_feature_SafeInteropWrappers
99
// REQUIRES: swift_feature_Lifetimes
10+
// REQUIRES: std_span
1011

1112
#if !BRIDGING_HEADER
1213
import StdSpan

test/Interop/Cxx/stdlib/std-span-transformed-execution.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// REQUIRES: swift_feature_LifetimeDependence
88

99
// REQUIRES: executable_test
10+
// REQUIRES: std_span
1011

1112
#if !BRIDGING_HEADER
1213
import StdSpan

test/Interop/Cxx/stdlib/use-std-span-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1
2+
// REQUIRES: std_span
23

34
import StdSpan
45

test/Interop/Cxx/stdlib/use-std-span.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// UNSUPPORTED: OS=windows-msvc
66

77
// REQUIRES: executable_test
8+
// REQUIRES: std_span
89

910
import StdlibUnittest
1011
#if !BRIDGING_HEADER

test/Interop/Cxx/swiftify-import/import-as-instance-method.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: swift_feature_SafeInteropWrappers
2+
// REQUIRES: std_span
23

34
// RUN: %empty-directory(%t)
45
// RUN: split-file %s %t

test/Interop/Cxx/swiftify-import/span-in-ctor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: swift_feature_SafeInteropWrappers
2+
// REQUIRES: std_span
23

34
// RUN: rm -rf %t
45
// RUN: split-file %s %t

test/Interop/CxxToSwiftToCxx/span/span-execution.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// RUN: %target-run %t/swift-cxx-execution | %FileCheck %s
1111

1212
// REQUIRES: executable_test
13+
// REQUIRES: std_span
1314

1415
//--- header.h
1516
#include <cstdint>

0 commit comments

Comments
 (0)