Skip to content

Commit 661ef67

Browse files
authored
Merge pull request #40967 from hyp/cxx-interop-test-restructure
[interop] restructure Swift -> C++ interop tests
2 parents da64dc4 + 60902cb commit 661ef67

File tree

6 files changed

+39
-25
lines changed

6 files changed

+39
-25
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -typecheck -module-name Test -emit-cxx-header-path %t/empty.h
3+
// RUN: %FileCheck %s < %t/empty.h
4+
5+
// RUN: %check-cxx-header-in-clang -std=c++14 %t/empty.h
6+
// RUN: %check-cxx-header-in-clang -std=c++17 %t/empty.h
7+
8+
// CHECK-LABEL: namespace Test {
9+
// CHECK: } // namespace Test

test/PrintAsCxx/empty.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -typecheck -emit-cxx-header-path %t/empty.h
33
// RUN: %FileCheck %s < %t/empty.h
44

5-
// RUN: %check-in-clang++ -std=c++14 %t/empty.h
6-
// RUN: %check-in-clang++ -std=c++17 %t/empty.h
5+
// RUN: %check-cxx-header-in-clang -std=c++14 %t/empty.h
6+
// RUN: %check-cxx-header-in-clang -std=c++17 %t/empty.h
77

88
// CHECK-NOT: @import Swift;
99
// CHECK-NOT: IBSegueAction

test/PrintAsCxx/lit.local.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/PrintAsObjC/empty.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
// RUN: %check-in-clang -std=c99 %t/empty.h
66
// RUN: %check-in-clang -std=c11 %t/empty.h
7-
// RUN: %check-in-clang++ -std=c++98 %t/empty.h
8-
// RUN: %check-in-clang++ -std=c++14 %t/empty.h
7+
// RUN: %check-cxx-header-in-clang -x objective-c++-header -std=c++98 %t/empty.h
8+
// RUN: %check-cxx-header-in-clang -x objective-c++-header -std=c++14 %t/empty.h
99

1010
// RUN: %check-in-clang -std=c99 -fno-modules -Qunused-arguments %t/empty.h
1111
// RUN: not %check-in-clang -I %S/Inputs/clang-headers %t/empty.h 2>&1 | %FileCheck %s --check-prefix=CUSTOM-OBJC-PROLOGUE

test/PrintAsObjC/lit.local.cfg

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,3 @@ config.substitutions.insert(0, ('%check-in-clang',
99
'-F %%clang-importer-sdk-path/frameworks '
1010
'-I %%clang-include-dir '
1111
'-isysroot %r/Inputs/clang-importer-sdk' % config.test_source_root) )
12-
13-
config.substitutions.insert(0, ('%check-in-clang\+\+',
14-
'%%clang++ -fsyntax-only -x objective-c++-header -fobjc-arc '
15-
'-Weverything -Werror -Wno-unused-macros -Wno-incomplete-module '
16-
'-Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic '
17-
'-Wno-unused-command-line-argument ' # for -fmodules-cache-path
18-
'-F %%clang-importer-sdk-path/frameworks '
19-
'-I %%clang-include-dir '
20-
'-isysroot %r/Inputs/clang-importer-sdk' % config.test_source_root) )

test/lit.cfg

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,39 @@ config.substitutions.append( ('%clang_apinotes',
558558
"%r -cc1apinotes" %
559559
(config.clang)) )
560560

561+
config.substitutions.append( ('%clangxx',
562+
"%r %s" %
563+
(config.clangxx, clang_mcp_opt)) )
564+
561565
# This must come after all substitutions containing "%clang".
562566
# Note: %clang is the locally-built clang.
563567
# To get Xcode's clang, use %target-clang.
564568
config.substitutions.append( ('%clang',
565569
"%r %s" %
566570
(config.clang, clang_mcp_opt)) )
567571

572+
# Verifies that a C++ file can be compiled without warnings except for some exceptions.
573+
config.substitutions.insert(0, ('%check-cxx-header-in-clang',
574+
'%%clangxx -fsyntax-only -x c++-header '
575+
# Turn on all warnings and promote them to errors
576+
'-Weverything -Werror '
577+
# Don't warn about unused macros in our C++.
578+
'-Wno-unused-macros '
579+
# Don't warn about module imports used at #includes.
580+
'-Wno-incomplete-module -Wno-auto-import '
581+
# Don't warn about any variadic macros we might have.
582+
'-Wno-variadic-macros '
583+
# Don't warn about any C++98 compatibility issues.
584+
'-Wno-c++98-compat-pedantic '
585+
# Don't warn about poison system directories in the Linux system paths.
586+
'-Wno-poison-system-directories '
587+
# For -fmodules-cache-path, when modules are off.
588+
'-Wno-unused-command-line-argument '
589+
# Use standard header/framework search paths.
590+
'-F %%clang-importer-sdk-path/frameworks '
591+
'-I %%clang-include-dir '
592+
'-isysroot %r/Inputs/clang-importer-sdk' % config.test_source_root) )
593+
568594
###
569595

570596
def disallow(execName):

0 commit comments

Comments
 (0)