Skip to content

Commit c8b61f9

Browse files
authored
Merge pull request #17615 from maniramezan/master
[SR-2250] Include Foundation framework instead of minimal NSObject.h
2 parents 2389286 + a3b30e2 commit c8b61f9

File tree

15 files changed

+18
-15
lines changed

15 files changed

+18
-15
lines changed

lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,7 @@ class ModuleWriter {
24382438
"#endif\n"
24392439
"\n"
24402440
"#pragma clang diagnostic ignored \"-Wauto-import\"\n"
2441-
"#include <objc/NSObject.h>\n"
2441+
"#include <Foundation/Foundation.h>\n"
24422442
"#include <stdint.h>\n"
24432443
"#include <stddef.h>\n"
24442444
"#include <stdbool.h>\n"

test/ClangImporter/MixedSource/resolve-cross-language.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -emit-module -enable-objc-interop -emit-objc-header -o %t %S/Inputs/resolve-cross-language/Base.swift -disable-objc-attr-requires-foundation-module
44
// RUN: cp %S/Inputs/resolve-cross-language/Base-module.map %t/module.map
5-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -enable-objc-interop -typecheck -I %t -F %S/Inputs/resolve-cross-language %s -verify
5+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -typecheck -I %t -F %clang-importer-sdk-path/frameworks -F %S/Inputs/resolve-cross-language %s -verify
66

77
import Base
88
import BaseUser

test/Index/cross_language.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// RUN: cat %s > %t/combined.m
1010
// RUN: cat %S/Inputs/cross_language.m >> %t/combined.m
11-
// RUN: c-index-test core -print-source-symbols -- %t/combined.m -I %t -isysroot %S/../Inputs/clang-importer-sdk >> %t.idx.out
11+
// RUN: c-index-test core -print-source-symbols -- %t/combined.m -F %clang-importer-sdk-path/frameworks -I %t -isysroot %S/../Inputs/clang-importer-sdk >> %t.idx.out
1212
// RUN: %FileCheck %t/combined.m -input-file %t.idx.out
1313

1414
#if SWIFT_CODE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#import <Foundation.h>

test/Inputs/clang-importer-sdk/usr/include/CoreFoundation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define __COREFOUNDATION__ 1
44

55
typedef const struct __CFAllocator * CFAllocatorRef;
6-
const CFAllocatorRef kCFAllocatorDefault;
6+
extern const CFAllocatorRef kCFAllocatorDefault;
77

88

99
typedef const void *CFTypeRef;

test/PrintAsObjC/cdecl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/cdecl.swiftmodule -typecheck -emit-objc-header-path %t/cdecl.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
44
// RUN: %FileCheck %s < %t/cdecl.h
55
// RUN: %check-in-clang %t/cdecl.h
6-
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/cdecl.h -include Foundation.h -include ctypes.h -include CoreFoundation.h
6+
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/cdecl.h -include ctypes.h -include CoreFoundation.h
77

88
// REQUIRES: objc_interop
99

test/PrintAsObjC/classes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// RUN: %FileCheck --check-prefix=NEGATIVE %s < %t/classes.h
1919
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ %t/classes.h
2020
// RUN: not %check-in-clang -I %S/Inputs/custom-modules/ -fno-modules -Qunused-arguments %t/classes.h
21-
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ -fno-modules -Qunused-arguments %t/classes.h -include Foundation.h -include CoreFoundation.h -include objc_generics.h -include SingleGenericClass.h -include CompatibilityAlias.h
21+
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ -fno-modules -Qunused-arguments %t/classes.h -include CoreFoundation.h -include objc_generics.h -include SingleGenericClass.h -include CompatibilityAlias.h
2222

2323
// CHECK-NOT: AppKit;
2424
// CHECK-NOT: Properties;

test/PrintAsObjC/empty.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// CHECK-NEXT: # define __has_feature(x) 0
2222
// CHECK-NEXT: #endif
2323

24-
// CHECK-LABEL: #include <objc/NSObject.h>
24+
// CHECK-LABEL: #include <Foundation/Foundation.h>
2525
// CHECK: #include <stdint.h>
2626
// CHECK: #include <stddef.h>
2727
// CHECK: #include <stdbool.h>

test/PrintAsObjC/enums-frozen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/enums.swiftmodule -typecheck -emit-objc-header-path %t/enums.h -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module -enable-resilience
44
// RUN: %FileCheck %s < %t/enums.h
55
// RUN: %check-in-clang %t/enums.h
6-
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include Foundation.h -include ctypes.h -include CoreFoundation.h
6+
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include ctypes.h -include CoreFoundation.h
77

88
// REQUIRES: objc_interop
99

test/PrintAsObjC/enums.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: %FileCheck %s < %t/enums.h
55
// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/enums.h
66
// RUN: %check-in-clang %t/enums.h
7-
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include Foundation.h -include ctypes.h -include CoreFoundation.h
7+
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include ctypes.h -include CoreFoundation.h
88

99
// REQUIRES: objc_interop
1010

test/PrintAsObjC/lit.local.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config.substitutions.insert(0, ('%check-in-clang',
66
'-fmodules-validate-system-headers '
77
'-Weverything -Werror -Wno-unused-macros -Wno-incomplete-module '
88
'-Wno-auto-import '
9+
'-F %%clang-importer-sdk-path/frameworks '
910
'-I %%clang-include-dir '
1011
'-isysroot %r/Inputs/clang-importer-sdk' % config.test_source_root) )
1112

@@ -14,5 +15,6 @@ config.substitutions.insert(0, ('%check-in-clang\+\+',
1415
'-Weverything -Werror -Wno-unused-macros -Wno-incomplete-module '
1516
'-Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic '
1617
'-Wno-unused-command-line-argument ' # for -fmodules-cache-path
18+
'-F %%clang-importer-sdk-path/frameworks '
1719
'-I %%clang-include-dir '
1820
'-isysroot %r/Inputs/clang-importer-sdk' % config.test_source_root) )

test/PrintAsObjC/reintroduced-new.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../../test/Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/Inputs/reintroduced-new.swift -swift-version 4 -disable-objc-attr-requires-foundation-module -module-name main
1010
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../../test/Inputs/clang-importer-sdk -I %t) -parse-as-library %t/main.swiftmodule -typecheck -emit-objc-header-path %t/generated.h -disable-objc-attr-requires-foundation-module -swift-version 4
11-
// RUN: not %clang -fsyntax-only -x objective-c %s -include %t/generated.h -fobjc-arc -fmodules -Werror -isysroot %S/../../test/Inputs/clang-importer-sdk 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-4 %s
11+
// RUN: not %clang -fsyntax-only -x objective-c %s -include %t/generated.h -fobjc-arc -fmodules -Werror -F %clang-importer-sdk-path/frameworks -isysroot %S/../../test/Inputs/clang-importer-sdk 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-4 %s
1212

1313
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../../test/Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/Inputs/reintroduced-new.swift -disable-objc-attr-requires-foundation-module -module-name main -swift-version 5
1414
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../../test/Inputs/clang-importer-sdk -I %t) -parse-as-library %t/main.swiftmodule -typecheck -emit-objc-header-path %t/generated.h -disable-objc-attr-requires-foundation-module -swift-version 5
15-
// RUN: not %clang -fsyntax-only -x objective-c %s -include %t/generated.h -fobjc-arc -fmodules -Werror -isysroot %S/../../test/Inputs/clang-importer-sdk 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-5 %s
15+
// RUN: not %clang -fsyntax-only -x objective-c %s -include %t/generated.h -fobjc-arc -fmodules -Werror -F %clang-importer-sdk-path/frameworks -isysroot %S/../../test/Inputs/clang-importer-sdk 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-5 %s
1616

1717
// CHECK-NOT: error:
1818

@@ -28,4 +28,4 @@ void test() {
2828
(void)[Sub new];
2929
}
3030

31-
// CHECK-NOT: error:
31+
// CHECK-NOT: error:

test/PrintAsObjC/simd.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -parse-as-library %t/simd_test.swiftmodule -typecheck -emit-objc-header-path %t/simd.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
1212
// RUN: %FileCheck %s < %t/simd.h
1313
// RUN: %check-in-clang %t/simd.h
14-
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/simd.h -include Foundation.h
14+
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/simd.h
1515

1616
// REQUIRES: objc_interop
1717

test/PrintAsObjC/swift_name.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %S/../Inputs/empty.swift -typecheck -emit-objc-header-path %t/empty.h
3-
// RUN: %clang -E -fobjc-arc -fmodules -isysroot %clang-importer-sdk-path -I %t %s | %FileCheck %s
3+
// RUN: %clang -F %clang-importer-sdk-path/frameworks -E -fobjc-arc -fmodules -isysroot %clang-importer-sdk-path -I %t %s | %FileCheck %s
44

55
// REQUIRES: objc_interop
66

test/PrintAsObjC/versioned.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/versioned.swiftmodule -typecheck -I %S/Inputs/custom-modules -emit-objc-header-path %t/versioned.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module -swift-version 3
1414
// RUN: %FileCheck %s < %t/versioned.h
1515
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ %t/versioned.h
16-
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ -fno-modules -Qunused-arguments %t/versioned.h -include Foundation.h -include VersionedFMWK.h
16+
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ -fno-modules -Qunused-arguments %t/versioned.h -include VersionedFMWK.h
1717

1818
import VersionedFMWK
1919

0 commit comments

Comments
 (0)