1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// Verify that symbolic interfaces are emitted.
//
// RUN: %target-swift-frontend %t/test.swift -I %t/Inputs -c -index-system-modules -index-store-path %t/store -enable-experimental-cxx-interop -Rindexing-system-module 2>%t/remarks
// RUN: echo "EOF" >> %t/remarks
// RUN: cat %t/remarks | %FileCheck --check-prefixes=REMARK_NEW,REMARK_INITIAL %s
// RUN: ls %t/store/interfaces | %FileCheck --check-prefix=FILES %s
// RUN: cat %t/store/interfaces/CxxModule* | %FileCheck --check-prefix=CHECK %s
// Verify that symbolic interfaces are not emitted when PCM doesn't change.
//
// RUN: %target-swift-frontend %t/test.swift -I %t/Inputs -c -index-system-modules -index-store-path %t/store -enable-experimental-cxx-interop -Rindexing-system-module 2>&1 | %FileCheck --check-prefix=REMARK_NO_UPDATE %s
// RUN: ls %t/store/interfaces | %FileCheck --check-prefix=FILES %s
// RUN: cat %t/store/interfaces/CxxModule* | %FileCheck --check-prefix=CHECK %s
// Verify that symbolic interface is re-emitted when the interface is removed.
//
// RUN: rm -r %t/store/interfaces
// RUN: %target-swift-frontend %t/test.swift -I %t/Inputs -c -index-system-modules -index-store-path %t/store -enable-experimental-cxx-interop -Rindexing-system-module 2>&1 | %FileCheck --check-prefix=REMARK_NEW %s
// RUN: ls %t/store/interfaces | %FileCheck --check-prefix=FILES %s
// RUN: cat %t/store/interfaces/CxxModule* | %FileCheck --check-prefixes=CHECK %s
// Verify that symbolic interface is re-emitted when PCM changes.
//
// RUN: echo "using AdditionalAlias = int;" >> %t/Inputs/headerA.h
// RUN: %target-swift-frontend %t/test.swift -I %t/Inputs -c -index-system-modules -index-store-path %t/store -enable-experimental-cxx-interop -Rindexing-system-module 2>&1 | %FileCheck --check-prefix=REMARK_NEW %s
// RUN: ls %t/store/interfaces | %FileCheck --check-prefix=FILES %s
// RUN: cat %t/store/interfaces/CxxModule* | %FileCheck --check-prefixes=CHECK,CHECK-UPDATED %s
//--- Inputs/module.modulemap
module CxxModule {
header "headerA.h"
header "headerB.h"
requires cplusplus
}
module TransitiveCppMod {
header "transitiveHeader.h"
requires cplusplus
}
//--- Inputs/headerA.h
namespace ns {
int freeFunction(int x, int y);
}
//--- Inputs/transitiveHeader.h
template<class T>
struct TransitiveStruct {
T x;
void test() {}
};
//--- Inputs/headerB.h
#include "headerA.h"
#include "transitiveHeader.h"
namespace ns {
struct B {
int y;
};
template<class T>
struct TemplateRecord {
void methodFunc(int x);
struct InnerRecord {
int innerMethod(int y);
};
template<class T2>
struct InnerTemplate {
void innerTemplateMethod();
};
InnerTemplate<int> returnsTemplateMethod();
};
inline namespace __1 {
struct StructInInlineNamespace {
};
using TypealiasInInlineNamespace = TemplateRecord<StructInInlineNamespace>;
}
using TypealiasOfInlineNamespace = __1::StructInInlineNamespace;
}
using MyType = ns::TemplateRecord<int>;
using MyType2 = TransitiveStruct<int>;
//--- test.swift
import CxxModule
// REMARK_INITIAL: remark: emitting symbolic interface at {{.*}}{{/|\\}}interfaces{{/|\\}}CxxShim-{{.*}}.pcm.symbolicswiftinterface{{$}}
// REMARK_NEW: remark: emitting symbolic interface at {{.*}}{{/|\\}}interfaces{{/|\\}}CxxModule-{{.*}}.pcm.symbolicswiftinterface{{$}}
// REMARK_INITIAL-NEXT: EOF
// REMARK_NO_UPDATE: remark: emitting symbolic interface at {{.*}}{{/|\\}}interfaces{{/|\\}}CxxModule-{{.*}}.pcm.symbolicswiftinterface; skipping because it's up to date{{$}}
// FILES: CxxModule-{{.*}}.pcm.symbolicswiftinterface
// FILES-NOT: TransitiveCppMod
// CHECK: // Swift interface for module 'CxxModule'
// CHECK-UPDATED: typealias AdditionalAlias =
// CHECK: enum ns {
// CHECK-EMPTY:
// CHECK-NEXT: struct B {
// CHECK-EMPTY:
// CHECK-NEXT: init()
// CHECK-EMPTY:
// CHECK-NEXT: init(y: Int32)
// CHECK-EMPTY:
// CHECK-NEXT: var y: Int32
// CHECK-NEXT: }
// CHECK-EMPTY:
// CHECK-NEXT: struct TemplateRecord {
// CHECK-EMPTY:
// CHECK-NEXT: @available(*, deprecated, message:
// CHECK-NEXT: public init()
// CHECK-EMPTY:
// CHECK-NEXT: mutating func methodFunc(_ x: Any)
// CHECK-EMPTY:
// CHECK-NEXT: struct InnerRecord {
// CHECK-EMPTY:
// CHECK-NEXT: @available(*, deprecated, message:
// CHECK-NEXT: public init()
// CHECK-EMPTY:
// CHECK-NEXT: mutating func innerMethod(_ y: Any)
// CHECK-NEXT: }
// CHECK-EMPTY:
// CHECK-NEXT: struct InnerTemplate {
// CHECK-EMPTY:
// CHECK-NEXT: @available(*, deprecated, message:
// CHECK-NEXT: public init()
// CHECK-EMPTY:
// CHECK-NEXT: mutating func innerTemplateMethod()
// CHECK-NEXT: }
// CHECK-EMPTY:
// CHECK-NEXT: mutating func returnsTemplateMethod()
// CHECK-NEXT: }
// CHECK: public struct StructInInlineNamespace {
// CHECK-EMPTY:
// CHECK-NEXT: public init()
// CHECK-NEXT: }
// CHECK-EMPTY:
// CHECK-NEXT: public typealias TypealiasInInlineNamespace = ns.TemplateRecord
// CHECK-EMPTY:
// CHECK-EMPTY:
// CHECK-NEXT: public typealias TypealiasOfInlineNamespace = ns.StructInInlineNamespace
// CHECK-EMPTY:
// CHECK-NEXT: static func freeFunction(_ x: Int32, _ y: Int32) -> Int32
// CHECK-NEXT: }
// CHECK-EMPTY:
// CHECK-NEXT: typealias MyType = ns.TemplateRecord
// CHECK-EMPTY:
// CHECK-NEXT: typealias MyType2 = TransitiveStruct
|