Skip to content

Commit 062d14b

Browse files
committed
Address @gribozavr comments to 273b149
1 parent 7368b08 commit 062d14b

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

stdlib/public/core/Process.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public enum Process {
1414
/// Initialize the swift argument with the list of command-line arguments
1515
/// with which the current process was invoked.
16-
public static func initArguments() {
16+
internal static func _initArguments() {
1717
for i in 0..<Int(argc) {
1818
_arguments.append(
1919
String.fromCStringRepairingIllFormedUTF8(unsafeArgv[i]).0 ?? "")
@@ -25,11 +25,12 @@ public enum Process {
2525
UnsafeMutablePointer<UnsafeMutablePointer<Int8>>
2626
= nil
2727

28-
internal static var _arguments : [String] = [String]()
28+
internal static var _arguments: [String] = []
2929

30-
/// Access to the swift arguments.
31-
public static var arguments : [String] {
32-
return _arguments;
30+
/// The list of command-line arguments with which the current
31+
/// process was invoked.
32+
public static var arguments: [String] {
33+
return _arguments
3334
}
3435

3536
/// Access to the raw argc value from C.
@@ -55,8 +56,8 @@ func _didEnterMain(
5556
// values that were passed in to main.
5657
Process._argc = CInt(argc)
5758
Process._unsafeArgv = UnsafeMutablePointer(argv)
58-
59-
// Initialize the swift arguments.
60-
Process.initArguments();
59+
// Arguments can only be initialized after _argc and _unsafeArgv are
60+
// initialized.
61+
Process._initArguments();
6162
}
6263

test/IRGen/expressions.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
import Swift
66

77

8-
// CHECK: private unnamed_addr constant [22 x i8] c"this is just a\0A\0A test\00"
8+
// CHECK: @[[const1:[0-9]+]] = private unnamed_addr constant [22 x i8] c"this is just a\0A\0A test\00"
9+
// CHECK: @[[const2:[0-9]+]] = private unnamed_addr constant [19 x i16] [i16 110, i16 111, i16 110, i16 45, i16 65, i16 83, i16 67, i16 73, i16 73, i16 32, i16 115, i16 116, i16 114, i16 105, i16 110, i16 103, i16 32, i16 181, i16 0]
910

1011
// CHECK: define hidden [[stringLayout:[^@]*]] @_TF11expressions17TestStringLiteralFT_SS() {{.*}} {
11-
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @8, i64 0, i64 0), i64 21, i1 true)
12+
// CHECK: call [[stringLayout]] @{{.*}}_builtinStringLiteral{{.*}}(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @[[const1]], i64 0, i64 0), i64 21, i1 true)
1213

1314
func TestStringLiteral() -> String {
1415
return "this is just a\n\u{0a} test"
1516
}
1617

1718
// CHECK: define hidden [[stringLayout]] @_TF11expressions18TestStringLiteral2FT_SS() {{.*}} {
18-
// CHECK: call [[stringLayout]] @{{.*}}_builtinUTF16StringLiteral{{.*}}(i8* bitcast ([19 x i16]* @9 to i8*), i64 18)
19+
// CHECK: call [[stringLayout]] @{{.*}}_builtinUTF16StringLiteral{{.*}}(i8* bitcast ([19 x i16]* @[[const2]] to i8*), i64 18)
1920
func TestStringLiteral2() -> String {
2021
return "non-ASCII string \u{00B5}"
2122
}

test/IRGen/objc_subscripts.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// REQUIRES: CPU=x86_64
44
// REQUIRES: objc_interop
55

6+
// CHECK: @[[const1:[0-9]+]] = private unnamed_addr constant [8 x i8] c"@16@0:8\00"
67
// CHECK: @_INSTANCE_METHODS__TtC15objc_subscripts10SomeObject =
78
// CHECK: private constant { i32, i32, [5 x { i8*, i8*, i8* }] }
89
// CHECK: { i32 24, i32 5, [5 x { i8*, i8*, i8* }]
@@ -32,7 +33,7 @@
3233
// CHECK: i8* bitcast (void ([[OPAQUE6:%.*]]*, i8*, i64, [[OPAQUE7:%.*]]*)* @_TToFC15objc_subscripts10SomeObjects9subscriptFS0_Si to i8*)
3334
// CHECK: },
3435
// CHECK: { i8*, i8*, i8* }
35-
// CHECK: { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @"\01L_selector_data(init)", i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @8, i64 0, i64 0), i8* bitcast ([[OPAQUE8:%.*]]* ([[OPAQUE9:%.*]]*, i8*)* @_TToFC15objc_subscripts10SomeObjectcfT_S0_ to i8*) }
36+
// CHECK: { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @"\01L_selector_data(init)", i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @[[const1]], i64 0, i64 0), i8* bitcast ([[OPAQUE8:%.*]]* ([[OPAQUE9:%.*]]*, i8*)* @_TToFC15objc_subscripts10SomeObjectcfT_S0_ to i8*) }
3637
// CHECK: ]
3738
// CHECK: }, section "__DATA, __objc_const", align 8
3839

0 commit comments

Comments
 (0)