Skip to content

Commit 1d47f1a

Browse files
authored
Merge pull request #59462 from apple/egorzhdan/cxx-libswift-workaround-arm64-linux-crash
[cxx-interop][SwiftCompilerSources] Workaround for `std::string` crash on arm64 Linux
2 parents ec2c25d + f476f62 commit 1d47f1a

File tree

8 files changed

+12
-15
lines changed

8 files changed

+12
-15
lines changed

SwiftCompilerSources/Sources/SIL/BasicBlock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasShortDescr
2525
public var function: Function { SILBasicBlock_getFunction(bridged).function }
2626

2727
public var description: String {
28-
String(_cxxString: SILBasicBlock_debugDescription(bridged))
28+
let stdString = SILBasicBlock_debugDescription(bridged)
29+
return String(_cxxString: stdString)
2930
}
3031
public var shortDescription: String { name }
3132

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ final public class Function : CustomStringConvertible, HasShortDescription {
2121
}
2222

2323
final public var description: String {
24-
String(_cxxString: SILFunction_debugDescription(bridged))
24+
let stdString = SILFunction_debugDescription(bridged)
25+
return String(_cxxString: stdString)
2526
}
2627

2728
public var shortDescription: String { name.string }

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ final public class GlobalVariable : CustomStringConvertible, HasShortDescription
1919
}
2020

2121
public var description: String {
22-
String(_cxxString: SILGlobalVariable_debugDescription(bridged))
22+
let stdString = SILGlobalVariable_debugDescription(bridged)
23+
return String(_cxxString: stdString)
2324
}
2425

2526
public var shortDescription: String { name.string }

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
3838
final public var function: Function { block.function }
3939

4040
final public var description: String {
41-
String(_cxxString: SILNode_debugDescription(bridgedNode))
41+
let stdString = SILNode_debugDescription(bridgedNode)
42+
return String(_cxxString: stdString)
4243
}
4344

4445
final public var operands: OperandArray {
@@ -142,7 +143,8 @@ public class SingleValueInstruction : Instruction, Value {
142143

143144
public final class MultipleValueInstructionResult : Value {
144145
final public var description: String {
145-
String(_cxxString: SILNode_debugDescription(bridgedNode))
146+
let stdString = SILNode_debugDescription(bridgedNode)
147+
return String(_cxxString: stdString)
146148
}
147149

148150
public var instruction: Instruction {

SwiftCompilerSources/Sources/SIL/Value.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public enum Ownership {
8181

8282
extension Value {
8383
public var description: String {
84-
String(_cxxString: SILNode_debugDescription(bridgedNode))
84+
let stdString = SILNode_debugDescription(bridgedNode)
85+
return String(_cxxString: stdString)
8586
}
8687

8788
public var uses: UseList {

test/SILOptimizer/addr_escape_info.sil

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
// REQUIRES: swift_in_compiler
44

5-
// rdar92963081
6-
// UNSUPPORTED: OS=linux-gnu
7-
85
sil_stage canonical
96

107
import Builtin

test/SILOptimizer/escape_info.sil

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
// REQUIRES: swift_in_compiler
44

5-
// rdar92963081
6-
// UNSUPPORTED: OS=linux-gnu
7-
85
sil_stage canonical
96

107
import Builtin

test/SILOptimizer/ranges.sil

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
// REQUIRES: swift_in_compiler
44

5-
// rdar92963081
6-
// UNSUPPORTED: OS=linux-gnu
7-
85
sil_stage canonical
96

107
// CHECK-LABEL: Instruction range in basic_test:

0 commit comments

Comments
 (0)