Skip to content

[cxx-interop][SwiftCompilerSources] Workaround for std::string crash on arm64 Linux #59462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SwiftCompilerSources/Sources/SIL/BasicBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasShortDescr
public var function: Function { SILBasicBlock_getFunction(bridged).function }

public var description: String {
String(_cxxString: SILBasicBlock_debugDescription(bridged))
let stdString = SILBasicBlock_debugDescription(bridged)
return String(_cxxString: stdString)
}
public var shortDescription: String { name }

Expand Down
3 changes: 2 additions & 1 deletion SwiftCompilerSources/Sources/SIL/Function.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ final public class Function : CustomStringConvertible, HasShortDescription {
}

final public var description: String {
String(_cxxString: SILFunction_debugDescription(bridged))
let stdString = SILFunction_debugDescription(bridged)
return String(_cxxString: stdString)
}

public var shortDescription: String { name.string }
Expand Down
3 changes: 2 additions & 1 deletion SwiftCompilerSources/Sources/SIL/GlobalVariable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ final public class GlobalVariable : CustomStringConvertible, HasShortDescription
}

public var description: String {
String(_cxxString: SILGlobalVariable_debugDescription(bridged))
let stdString = SILGlobalVariable_debugDescription(bridged)
return String(_cxxString: stdString)
}

public var shortDescription: String { name.string }
Expand Down
6 changes: 4 additions & 2 deletions SwiftCompilerSources/Sources/SIL/Instruction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
final public var function: Function { block.function }

final public var description: String {
String(_cxxString: SILNode_debugDescription(bridgedNode))
let stdString = SILNode_debugDescription(bridgedNode)
return String(_cxxString: stdString)
}

final public var operands: OperandArray {
Expand Down Expand Up @@ -142,7 +143,8 @@ public class SingleValueInstruction : Instruction, Value {

public final class MultipleValueInstructionResult : Value {
final public var description: String {
String(_cxxString: SILNode_debugDescription(bridgedNode))
let stdString = SILNode_debugDescription(bridgedNode)
return String(_cxxString: stdString)
}

public var instruction: Instruction {
Expand Down
3 changes: 2 additions & 1 deletion SwiftCompilerSources/Sources/SIL/Value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public enum Ownership {

extension Value {
public var description: String {
String(_cxxString: SILNode_debugDescription(bridgedNode))
let stdString = SILNode_debugDescription(bridgedNode)
return String(_cxxString: stdString)
}

public var uses: UseList {
Expand Down
3 changes: 0 additions & 3 deletions test/SILOptimizer/addr_escape_info.sil
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

// REQUIRES: swift_in_compiler

// rdar92963081
// UNSUPPORTED: OS=linux-gnu

sil_stage canonical

import Builtin
Expand Down
3 changes: 0 additions & 3 deletions test/SILOptimizer/escape_info.sil
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

// REQUIRES: swift_in_compiler

// rdar92963081
// UNSUPPORTED: OS=linux-gnu

sil_stage canonical

import Builtin
Expand Down
3 changes: 0 additions & 3 deletions test/SILOptimizer/ranges.sil
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

// REQUIRES: swift_in_compiler

// rdar92963081
// UNSUPPORTED: OS=linux-gnu

sil_stage canonical

// CHECK-LABEL: Instruction range in basic_test:
Expand Down