Skip to content

Commit e8f56e1

Browse files
authored
Merge pull request #22684 from compnerd/import-💖
2 parents c19fb07 + fd75ed7 commit e8f56e1

File tree

10 files changed

+28
-24
lines changed

10 files changed

+28
-24
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#import <NonModular.h>
1+
#include <NonModular.h>
22

33
extern int x;

‎test/ClangImporter/MixedSource/autolinking.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public let y = Test()
1212

1313
// CHECK: !llvm.linker.options
1414
// CHECK-NOT: !{!"-framework", !"AutolinkingTest"}
15-
// CHECK: !{!"-lswiftCore"}
16-
// CHECK-NOT: !{!"-framework", !"AutolinkingTest"}
15+
// CHECK: !{!{{"-lswiftCore"|"/DEFAULTLIB:swiftCore.lib"}}}
16+
// CHECK-NOT: !{!"-framework", !"AutolinkingTest"}

‎test/ClangImporter/MixedSource/broken-modules.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %empty-directory(%t)
2+
23
// RUN: not %target-swift-frontend -enable-objc-interop -typecheck %/s -I %S/Inputs/broken-modules/ -enable-source-import -show-diagnostics-after-fatal -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK -check-prefix CLANG-CHECK %s
34

45
// RUN: not %target-swift-frontend -typecheck %/s -enable-objc-interop -import-objc-header %S/Inputs/broken-modules/BrokenClangModule.h -enable-source-import -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK-BRIDGING-HEADER -check-prefix CLANG-CHECK %s
@@ -22,13 +23,13 @@ import MissingDependencyFromClang
2223
// CHECK: error: no such module 'MissingDependencyFromClang'
2324

2425
import BrokenClangModule
25-
// CLANG-CHECK: {{.+}}/Inputs/broken-modules/BrokenClangModule.h:2:13: error: redefinition of 'conflict' as different kind of symbol
26-
// CLANG-CHECK: {{.+}}/Inputs/broken-modules/BrokenClangModule.h:1:5: note: previous definition is here
26+
// CLANG-CHECK: {{.+}}{{/|\\}}Inputs{{/|\\}}broken-modules{{/|\\}}BrokenClangModule.h:2:13: error: redefinition of 'conflict' as different kind of symbol
27+
// CLANG-CHECK: {{.+}}{{/|\\}}Inputs{{/|\\}}broken-modules{{/|\\}}BrokenClangModule.h:1:5: note: previous definition is here
2728
// CLANG-CHECK: a-fake-file.h:43:13: error: redefinition of 'conflict2' as different kind of symbol
2829
// CLANG-CHECK: a-fake-file.h:42:5: note: previous definition is here
2930
// CLANG-CHECK: a-fake-file.h:46:5: error: expected identifier or '('
3031
// CLANG-CHECK: a-fake-file.h:45:11: note: expanded from macro 'I'
31-
// CLANG-CHECK: {{.+}}/Inputs/broken-modules/BrokenClangModule.h:11:35: error: expected ';' after top level declarator
32+
// CLANG-CHECK: {{.+}}{{/|\\}}Inputs{{/|\\}}broken-modules{{/|\\}}BrokenClangModule.h:11:35: error: expected ';' after top level declarator
3233

3334
// CHECK: broken-modules.swift:[[@LINE-9]]:8: error: could not build Objective-C module 'BrokenClangModule'
3435
// CHECK: error: no such module 'BrokenClangModule'

‎test/ClangImporter/MixedSource/import-mixed-with-header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// RUN: rm -rf %t/mixed-target/
1313
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/../Inputs/custom-modules -enable-objc-interop -typecheck %s -verify
1414

15-
// XFAIL: linux
15+
// REQUIRES: SR7768
1616

1717
import MixedWithHeader
1818

‎test/ClangImporter/autolinking.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -emit-ir -o - | %FileCheck %s
2+
3+
// RUN: %target-swift-frontend %s -sdk %S/Inputs -Fsystem %S/Inputs/System/Library/Frameworks -enable-objc-interop -I %S/Inputs/custom-modules -emit-ir -o - | %FileCheck %s
34

45
// RUN: %target-swift-frontend -emit-module %S/Inputs/adapter.swift -sdk %S/Inputs -module-link-name SwiftAdapter -module-name ClangModuleWithAdapter -I %S/Inputs/custom-modules -o %t
56

6-
// RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -I %t -emit-ir -o %t/with-adapter.ll
7+
// RUN: %target-swift-frontend %s -sdk %S/Inputs -Fsystem %S/Inputs/System/Library/Frameworks -enable-objc-interop -I %S/Inputs/custom-modules -I %t -emit-ir -o %t/with-adapter.ll
78
// RUN: %FileCheck %s < %t/with-adapter.ll
89
// RUN: %FileCheck -check-prefix CHECK-WITH-SWIFT %s < %t/with-adapter.ll
910

10-
// RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -emit-ir -disable-autolink-framework LinkFramework -o - > %t/with-disabled.ll
11+
// RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -Fsystem %S/Inputs/System/Library/Frameworks -enable-objc-interop -emit-ir -disable-autolink-framework LinkFramework -o - > %t/with-disabled.ll
1112
// RUN: %FileCheck -check-prefix CHECK-WITH-DISABLED %s < %t/with-disabled.ll
1213
// RUN: %FileCheck -check-prefix NEGATIVE-WITH-DISABLED %s < %t/with-disabled.ll
1314

@@ -29,15 +30,15 @@ UsesSubmodule.useSomethingFromSubmodule()
2930

3031
// CHECK: !llvm.linker.options = !{
3132

32-
// CHECK-DAG: !{{[0-9]+}} = !{!"-lLock"}
33-
// CHECK-DAG: !{{[0-9]+}} = !{!"-lStock"}
33+
// CHECK-DAG: !{{[0-9]+}} = !{!{{"-lLock"|"/DEFAULTLIB:Lock.lib"}}}
34+
// CHECK-DAG: !{{[0-9]+}} = !{!{{"-lStock"|"/DEFAULTLIB:Stock.lib"}}}
3435
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"Barrel"}
3536
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"LinkFramework"}
36-
// CHECK-DAG: !{{[0-9]+}} = !{!"-lUnderlyingClangLibrary"}
37+
// CHECK-DAG: !{{[0-9]+}} = !{!{{"-lUnderlyingClangLibrary"|"/DEFAULTLIB:UnderlyingClangLibrary.lib"}}}
3738
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"Indirect"}
3839
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"HasSubmodule"}
3940

40-
// CHECK-WITH-SWIFT: !{{[0-9]+}} = !{!"-lSwiftAdapter"}
41+
// CHECK-WITH-SWIFT: !{{[0-9]+}} = !{!{{"-lSwiftAdapter"|"/DEFAULTLIB:SwiftAdapter.lib"}}}
4142

4243
// CHECK-WITH-DISABLED-DAG: !{!"-framework", !"Barrel"}
4344
// CHECK-WITH-DISABLED-DAG: !{!"-framework", !"Indirect"}

‎test/ClangImporter/broken-modules.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#if MISSING_FROM_MODULE
88
import MissingHeader
9-
// CHECK-MODULE-MAP: {{.*}}/Inputs/custom-modules/module.map:{{[0-9]+:[0-9]+}}: error: header 'this-header-does-not-exist.h' not found
9+
// CHECK-MODULE-MAP: {{.*}}{{/|\\}}Inputs{{/|\\}}custom-modules{{/|\\}}module.map:{{[0-9]+:[0-9]+}}: error: header 'this-header-does-not-exist.h' not found
1010
// CHECK-MODULE-MAP: broken-modules.swift:[[@LINE-2]]:8: error: could not build Objective-C module 'MissingHeader'
1111

1212
#else
@@ -17,7 +17,7 @@ import ImportsMissingHeaderIndirect
1717
import ImportsMissingHeader
1818
#endif
1919

20-
// CHECK-INDIRECT: {{.*}}/Inputs/custom-modules/more-custom-modules/ImportsMissingHeaderIndirect.h:1:9: note: while building module 'ImportsMissingHeader' imported from {{.*}}/Inputs/custom-modules/more-custom-modules/ImportsMissingHeaderIndirect.h:1:
20+
// CHECK-INDIRECT: {{.*}}{{/|\\}}Inputs{{/|\\}}custom-modules{{/|\\}}more-custom-modules{{/|\\}}ImportsMissingHeaderIndirect.h:1:9: note: while building module 'ImportsMissingHeader' imported from {{.*}}{{/|\\}}Inputs{{/|\\}}custom-modules{{/|\\}}more-custom-modules{{/|\\}}ImportsMissingHeaderIndirect.h:1:
2121
// CHECK-INDIRECT-NEXT: @import ImportsMissingHeader;
2222

2323
// CHECK: <module-includes>:1:9: note: in file included from <module-includes>:1:
@@ -28,7 +28,7 @@ import ImportsMissingHeader
2828
// CHECK-INDIRECT: <module-includes>:1:9: note: in file included from <module-includes>:1:
2929
// CHECK-INDIRECT-NEXT: #import "{{.*}}ImportsMissingHeaderIndirect.h"
3030

31-
// CHECK-INDIRECT: {{.*}}/Inputs/custom-modules/more-custom-modules/ImportsMissingHeaderIndirect.h:1:9: error: could not build module 'ImportsMissingHeader'
31+
// CHECK-INDIRECT: {{.*}}{{/|\\}}Inputs{{/|\\}}custom-modules{{/|\\}}more-custom-modules{{/|\\}}ImportsMissingHeaderIndirect.h:1:9: error: could not build module 'ImportsMissingHeader'
3232
// CHECK-INDIRECT-NEXT: @import ImportsMissingHeader;
3333

3434

‎test/ClangImporter/non-modular-include.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: not %target-swift-frontend -enable-objc-interop -typecheck %/s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | %FileCheck --check-prefix=CHECK -check-prefix CHECK-objc %s
33
// RUN: not %target-swift-frontend -disable-objc-interop -typecheck %/s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | %FileCheck --check-prefix=CHECK -check-prefix CHECK-native %s
44

5-
// CHECK: {{.+}}/non-modular/Foo.framework/Headers/Foo.h:1:9: error: include of non-modular header inside framework module 'Foo'
5+
// CHECK: {{.+}}/non-modular{{/|\\}}Foo.framework/Headers{{/|\\}}Foo.h:1:10: error: include of non-modular header inside framework module 'Foo'
66
// CHECK-objc: error: could not build Objective-C module 'Foo'
77
// CHECK-native: error: could not build C module 'Foo'
88
// CHECK-NOT: error

‎test/ClangImporter/pch-bridging-header-deps.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
// Generate a bridging PCH, use it in a swift file, and check that the swift file's .swiftdeps
44
// mention the .h the PCH was generated from, and any .h files included in it.
55
//
6-
// RUN: %target-swift-frontend -emit-pch -o %t.pch %S/Inputs/chained-unit-test-bridging-header-to-pch.h
6+
// RUN: %target-swift-frontend -emit-pch -o %t.pch %/S/Inputs/chained-unit-test-bridging-header-to-pch.h
77
// RUN: %target-swift-frontend -module-name test -c -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -primary-file %s -import-objc-header %t.pch
88
// RUN: %FileCheck --check-prefix CHECK-DEPS %s < %t.d
99
// RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS %s < %t.swiftdeps
1010
// RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS2 %s < %t.swiftdeps
1111

12-
// RUN: %target-swift-frontend -module-name test -c -emit-dependencies-path %t.persistent.d -emit-reference-dependencies-path %t.persistent.swiftdeps -primary-file %s -import-objc-header %S/Inputs/chained-unit-test-bridging-header-to-pch.h -pch-output-dir %t/pch
12+
// RUN: %target-swift-frontend -module-name test -c -emit-dependencies-path %t.persistent.d -emit-reference-dependencies-path %t.persistent.swiftdeps -primary-file %s -import-objc-header %/S/Inputs/chained-unit-test-bridging-header-to-pch.h -pch-output-dir %t/pch
1313
// RUN: %FileCheck --check-prefix CHECK-DEPS %s < %t.persistent.d
1414
// RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS %s < %t.persistent.swiftdeps
1515
// RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS2 %s < %t.persistent.swiftdeps
1616

1717
print(app_function(1))
1818

19-
// CHECK-DEPS: pch-bridging-header-deps.o : {{.*}}SOURCE_DIR/test/ClangImporter/Inputs/app-bridging-header-to-pch.h {{.*}}SOURCE_DIR/test/ClangImporter/Inputs/chained-unit-test-bridging-header-to-pch.h
19+
// CHECK-DEPS: pch-bridging-header-deps.o : {{.*}}SOURCE_DIR{{/|\\}}test{{/|\\}}ClangImporter{{/|\\}}Inputs{{/|\\}}app-bridging-header-to-pch.h {{.*}}SOURCE_DIR{{/|\\}}test{{/|\\}}ClangImporter{{/|\\}}Inputs{{/|\\}}chained-unit-test-bridging-header-to-pch.h
2020

2121
// CHECK-SWIFTDEPS: depends-external:
22-
// CHECK-SWIFTDEPS: - "SOURCE_DIR/test/ClangImporter/Inputs/app-bridging-header-to-pch.h"
23-
// CHECK-SWIFTDEPS: - "SOURCE_DIR/test/ClangImporter/Inputs/chained-unit-test-bridging-header-to-pch.h"
22+
// CHECK-SWIFTDEPS: - "SOURCE_DIR{{/|\\\\}}test{{/|\\\\}}ClangImporter{{/|\\\\}}Inputs{{/|\\\\}}app-bridging-header-to-pch.h"
23+
// CHECK-SWIFTDEPS: - "SOURCE_DIR{{/|\\\\}}test{{/|\\\\}}ClangImporter{{/|\\\\}}Inputs{{/|\\\\}}chained-unit-test-bridging-header-to-pch.h"
2424

2525
// CHECK-SWIFTDEPS2-NOT: {{.*}}.pch

‎test/ClangImporter/sdk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-typecheck-verify-swift
22

3-
// XFAIL: linux
3+
// REQUIRES: objc_interop
44

55
import Foundation
66

‎test/Inputs/clang-importer-sdk/usr/include/MacTypes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ STDLIB_TYPEDEF(__UINT8_TYPE__, UInt8);
1414
STDLIB_TYPEDEF(__UINT16_TYPE__, UInt16);
1515
STDLIB_TYPEDEF(__UINT32_TYPE__, UInt32);
1616

17+
#if !defined(_WIN32)
1718
#include <stdint.h>
19+
#endif
1820

1921
typedef SInt32 Fixed;
2022
typedef Fixed * FixedPtr;

0 commit comments

Comments
 (0)