Skip to content

Commit 24591ef

Browse files
fjriccibob-wilson
authored andcommitted
Remove Darwin module's dependency on ctypes.h
Upstream cfe change r284797 requires that the Darwin module only depend on its submodules. This means it cannot depend on ctypes, so we need to split up this dependency in the swift test suite.
1 parent 37c8a1c commit 24591ef

File tree

7 files changed

+46
-6
lines changed

7 files changed

+46
-6
lines changed

test/ClangModules/Inputs/custom-modules/Redeclaration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ typedef struct CGPoint CGPoint;
55
typedef CGPoint NSPoint;
66
NSString *NSStringToNSString(NSString *str);
77

8-
struct FooStruct1 {
8+
struct FooStructA {
99
int x;
1010
double y;
1111
};

test/ClangModules/MixedSource/Inputs/mixed-with-header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public func testProtocolWrapper(_ conformer: ForwardClassUser) {
2424
conformer.consumeForwardClass(conformer.forward)
2525
}
2626

27-
public func testStruct(_ p: Point) -> Point {
27+
public func testStruct(_ p: Darwin.Point) -> Darwin.Point {
2828
var result = p
2929
result.y += 5
3030
return result

test/ClangModules/MixedSource/import-mixed-with-header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ func testCrossReferences(_ derived: Derived) {
2727
_ = obj.safeOverrideProto(ForwardProtoAdopter()) as NSObject
2828

2929
testProtocolWrapper(ProtoConformer())
30-
_ = testStruct(Point(x: 2,y: 3))
30+
_ = testStruct(Darwin.Point(x: 2,y: 3))
3131
}

test/ClangModules/MixedSource/mixed-target-using-header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func testProtocolWrapper(_ conformer: ForwardClassUser) {
3939
}
4040
testProtocolWrapper(ProtoConformer())
4141

42-
func testStruct(_ p: Point) -> Point {
42+
func testStruct(_ p: Darwin.Point) -> Darwin.Point {
4343
var result = p
4444
result.y += 5
4545
return result

test/ClangModules/adapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ let encoding: UInt = NSUTF8StringEncoding
1717
let viaTypedef: Redeclaration.NSPoint = AppKit.NSPoint(x: 0, y: 0)
1818
Redeclaration.NSStringToNSString(AppKit.NSStringToNSString("abc")) // expected-warning {{result of call is unused}}
1919

20-
let viaStruct: Redeclaration.FooStruct1 = AppKit.FooStruct1()
20+
let viaStruct: Redeclaration.FooStructA = AppKit.FooStructA()
2121
let forwardDecl: Redeclaration.Tribool = AppKit.Tribool() // expected-error {{no type named 'Tribool' in module 'Redeclaration'}}

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

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
11
#ifndef __MACTYPES__
22
#define __MACTYPES__
33

4-
#include "ctypes.h"
4+
#define STDLIB_TEST(TYPE, NAME) extern NAME NAME##_test
5+
#define STDLIB_TYPEDEF(TYPE, NAME) \
6+
typedef TYPE NAME; \
7+
STDLIB_TEST(TYPE, NAME)
8+
9+
STDLIB_TYPEDEF(__INT8_TYPE__, SInt8);
10+
STDLIB_TYPEDEF(__INT16_TYPE__, SInt16);
11+
STDLIB_TYPEDEF(__INT32_TYPE__, SInt32);
12+
13+
STDLIB_TYPEDEF(__UINT8_TYPE__, UInt8);
14+
STDLIB_TYPEDEF(__UINT16_TYPE__, UInt16);
15+
STDLIB_TYPEDEF(__UINT32_TYPE__, UInt32);
16+
17+
#include <stdint.h>
18+
19+
#if !defined(__have_Point)
20+
#define __have_Point
21+
struct Point {
22+
float x;
23+
float y;
24+
};
25+
#endif
26+
27+
/*!
28+
@keyword FooA, StructA
29+
*/
30+
struct FooStructA {
31+
/*!
32+
@keyword x, StructA
33+
@recommended y
34+
*/
35+
int x;
36+
/*!
37+
@keyword y, StructA
38+
@recommendedover x
39+
*/
40+
double y;
41+
};
542

643
typedef SInt32 Fixed;
744
typedef Fixed * FixedPtr;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ enum {
1717
AnonConstSmall2
1818
};
1919

20+
#if !defined(__have_Point)
21+
#define __have_Point
2022
struct Point {
2123
float x;
2224
float y;
2325
};
26+
#endif
2427

2528
typedef struct {
2629
struct {

0 commit comments

Comments
 (0)