File tree Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,9 @@ class ModuleDecl
194
194
current = clangModule;
195
195
}
196
196
197
+ // / Returns the name of the current module.
198
+ // / Note that for a Swift module, it returns the current module's real (binary) name,
199
+ // / which can be different from the name if module aliasing was used (see -module-alias).
197
200
StringRef operator *() const ;
198
201
ReverseFullNameIterator &operator ++();
199
202
Original file line number Diff line number Diff line change
1
+ /// Test AST with module aliasing.
2
+ ///
3
+ /// Module 'Lib' imports module 'XLogging', and 'XLogging' is aliased 'AppleLogging'.
4
+
5
+ // RUN: %empty-directory(%t)
6
+ // RUN: %{python} %utils/split_file.py -o %t %s
7
+
8
+ /// Create AppleLogging.swiftmodule by aliasing XLogging
9
+ // RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
10
+ // RUN: test -f %t/AppleLogging.swiftmodule
11
+
12
+ /// Verify AST contains XLogging, not AppleLogging
13
+ // RUN: %target-swift-frontend -dump-ast %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/result-ast.output
14
+
15
+ // RUN: %FileCheck %s -input-file %t/result-ast.output -check-prefix CHECK-AST
16
+ // CHECK-AST: XLogging
17
+ // RUN: not %FileCheck %s -input-file %t/result-ast.output -check-prefix CHECK-NOT-AST
18
+ // CHECK-NOT-AST: AppleLogging
19
+
20
+
21
+ // BEGIN FileLogging.swift
22
+ public struct Logger {
23
+ public init ( ) { }
24
+ }
25
+ public func setup( ) -> XLogging . Logger ? {
26
+ return Logger ( )
27
+ }
28
+
29
+ // BEGIN FileLib.swift
30
+ import XLogging
31
+
32
+ public func start( ) -> XLogging . Logger ? {
33
+ return XLogging . setup ( )
34
+ }
35
+
36
+ public func end( _ arg: XLogging . Logger ) {
37
+ }
Original file line number Diff line number Diff line change
1
+ /// Test SIL with module aliasing.
2
+ ///
3
+ /// Module 'Lib' imports module 'XLogging', and 'XLogging' is aliased 'AppleLogging'.
4
+
5
+ // RUN: %empty-directory(%t)
6
+ // RUN: %{python} %utils/split_file.py -o %t %s
7
+
8
+ /// Create AppleLogging.swiftmodule by aliasing XLogging
9
+ // RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
10
+ // RUN: test -f %t/AppleLogging.swiftmodule
11
+
12
+ /// Verify generated SIL contains AppleLogging, and XLogging only appears in import lines in the prologue
13
+ // RUN: %target-swift-frontend -emit-sil %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/result-sil.output
14
+ // RUN: %FileCheck %s -input-file %t/result-sil.output -check-prefix CHECK-SIL
15
+ // CHECK-SIL: import XLogging
16
+ // CHECK-SIL: s12AppleLogging
17
+ // RUN: not %FileCheck %s -input-file %t/result-sil.output -check-prefix CHECK-NOT-SIL
18
+ // CHECK-NOT-SIL: s8XLogging
19
+
20
+ // BEGIN FileLogging.swift
21
+ public struct Logger {
22
+ public init ( ) { }
23
+ }
24
+ public func setup( ) -> XLogging . Logger ? {
25
+ return Logger ( )
26
+ }
27
+
28
+ // BEGIN FileLib.swift
29
+ import XLogging
30
+
31
+ public func start( ) -> XLogging . Logger ? {
32
+ return XLogging . setup ( )
33
+ }
34
+
35
+ public func end( _ arg: XLogging . Logger ) {
36
+ }
You can’t perform that action at this time.
0 commit comments