Skip to content

Commit 46c67a9

Browse files
authored
Merge pull request #18 from apple/string-init
[LLVM] Add `llvm::StringRef` -> `String` initializer
2 parents a132e1c + 5484308 commit 46c67a9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/LLVM/LLVM_Utils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
@_exported import LLVM_Utils // Clang module
1414

1515
extension String {
16+
public init(_ stringRef: llvm.StringRef) {
17+
self.init(cxxString: stringRef.str())
18+
}
19+
1620
public func withStringRef<Result>(_ body: (llvm.StringRef) -> Result) -> Result {
1721
var str = self
1822
return str.withUTF8 { buffer in

0 commit comments

Comments
 (0)