Skip to content

Commit 7592b18

Browse files
committed
SwiftCompilerSources: Add a standardError utility
1 parent bda4f52 commit 7592b18

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SwiftCompilerSources/Sources/Basic/Utils.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ public extension NoReflectionChildren {
5252
var customMirror: Mirror { Mirror(self, children: []) }
5353
}
5454

55+
public var standardError = CFileStream(fp: stderr)
56+
57+
public struct CFileStream: TextOutputStream {
58+
var fp: UnsafeMutablePointer<FILE>
59+
60+
public func write(_ string: String) {
61+
fputs(string, fp)
62+
}
63+
64+
public func flush() {
65+
fflush(fp)
66+
}
67+
}
5568

5669
//===----------------------------------------------------------------------===//
5770
// StringRef

0 commit comments

Comments
 (0)