Swift SIL: make Function.name and GlobalVariable.name return a StringRef and not a String

and introduce the StringRef struct.
It's more efficient.

Also, rename the `HasName` protocol to `HasShortDescription`, which introduces the new requirement `shortDescription`. This is need because `name` now has `StringRef` type and not `String` anymore
This commit is contained in:
Erik Eckstein
2022-05-12 10:00:25 +02:00
parent e8194155f0
commit cd456fa792
6 changed files with 43 additions and 13 deletions

View File

@@ -13,7 +13,7 @@
import Basic
import SILBridging
final public class BasicBlock : ListNode, CustomStringConvertible, HasName {
final public class BasicBlock : ListNode, CustomStringConvertible, HasShortDescription {
public var next: BasicBlock? { SILBasicBlock_next(bridged).block }
public var previous: BasicBlock? { SILBasicBlock_previous(bridged).block }
@@ -28,6 +28,7 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasName {
var s = SILBasicBlock_debugDescription(bridged)
return String(cString: s.c_str())
}
public var shortDescription: String { name }
public var arguments: ArgumentArray { ArgumentArray(block: self) }