Skip to content

Commit b6643b2

Browse files
authored
Merge pull request swiftlang#40054 from eeckstein/fix-libswift-ubuntu-build
libswift: don't use the internal C++ namespace
2 parents b37f77f + 99fb829 commit b6643b2

File tree

6 files changed

+12
-30
lines changed

6 files changed

+12
-30
lines changed

libswift/Sources/SIL/BasicBlock.swift

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

2121
public var description: String {
22-
SILBasicBlock_debugDescription(bridged).string
22+
var s = SILBasicBlock_debugDescription(bridged)
23+
return String(cString: s.c_str())
2324
}
2425

2526
public var arguments: ArgumentArray { ArgumentArray(block: self) }

libswift/Sources/SIL/Function.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ final public class Function : CustomStringConvertible {
1818
}
1919

2020
final public var description: String {
21-
return SILFunction_debugDescription(bridged).string
21+
var s = SILFunction_debugDescription(bridged)
22+
return String(cString: s.c_str())
2223
}
2324

2425
public var entryBlock: BasicBlock {

libswift/Sources/SIL/GlobalVariable.swift

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

2020
public var description: String {
21-
return SILGlobalVariable_debugDescription(bridged).string
21+
var s = SILGlobalVariable_debugDescription(bridged)
22+
return String(cString: s.c_str())
2223
}
2324

2425
// TODO: initializer instructions

libswift/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
3030
}
3131

3232
final public var description: String {
33-
SILNode_debugDescription(bridgedNode).string
33+
var s = SILNode_debugDescription(bridgedNode)
34+
return String(cString: s.c_str())
3435
}
3536

3637
final public var operands: OperandArray {
@@ -123,7 +124,8 @@ public class SingleValueInstruction : Instruction, Value {
123124

124125
public final class MultipleValueInstructionResult : Value {
125126
final public var description: String {
126-
SILNode_debugDescription(bridgedNode).string
127+
var s = SILNode_debugDescription(bridgedNode)
128+
return String(cString: s.c_str())
127129
}
128130

129131
public var instruction: Instruction {

libswift/Sources/SIL/Utils.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,6 @@ extension BridgedStringRef {
8181
}
8282
}
8383

84-
#if os(Linux)
85-
86-
extension std.__cxx11.string {
87-
public var string: String {
88-
// TODO: remove this once a new version of Swift is released (and call
89-
// c_str() directly).
90-
let mutableSelf = self
91-
return String(cString: mutableSelf.c_str())
92-
}
93-
}
94-
95-
#else
96-
97-
extension std.__1.string {
98-
public var string: String {
99-
// TODO: remove this once a new version of Swift is released (and call
100-
// c_str() directly).
101-
var mutableSelf = self
102-
return String(cString: mutableSelf.c_str())
103-
}
104-
}
105-
106-
#endif
107-
10884
extension String {
10985
public func withBridgedStringRef<T>(_ c: (BridgedStringRef) -> T) -> T {
11086
var str = self

libswift/Sources/SIL/Value.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public protocol Value : AnyObject, CustomStringConvertible {
2020

2121
extension Value {
2222
public var description: String {
23-
SILNode_debugDescription(bridgedNode).string
23+
var s = SILNode_debugDescription(bridgedNode)
24+
return String(cString: s.c_str())
2425
}
2526

2627
public var uses: UseList {

0 commit comments

Comments
 (0)