[stdlib/private][oslog] Make tiny helper functions of struct OSLogMessage constant_evaluable

instead of transparent.
This commit is contained in:
Ravi Kandhadai
2019-11-19 12:17:59 -08:00
parent 0dc9a0e964
commit 05be088431
5 changed files with 19 additions and 13 deletions

View File

@@ -43,11 +43,14 @@ public enum Privacy {
/// Maximum number of arguments i.e., interpolated expressions that can
/// be used in the string interpolations passed to the log APIs.
/// This limit is imposed by the ABI of os_log.
@_transparent
@_semantics("constant_evaluable")
@inlinable
@_optimize(none)
public var maxOSLogArgumentCount: UInt8 { return 48 }
@usableFromInline
@_transparent
@_semantics("constant_evaluable")
@inlinable
@_optimize(none)
internal var logBitsPerByte: Int { return 3 }
/// Represents a string interpolation passed to the log APIs.
@@ -303,7 +306,8 @@ public struct OSLogMessage :
/// The byte size of the buffer that will be passed to the C os_log ABI.
/// It will contain the elements of `interpolation.arguments` and the two
/// summary bytes: preamble and argument count.
@_transparent
@_semantics("constant_evaluable")
@inlinable
@_optimize(none)
public var bufferSize: Int {
return interpolation.totalBytesForSerializingArguments + 2
@@ -353,8 +357,9 @@ internal struct OSLogArguments {
/// Serialize a UInt8 value at the buffer location pointed to by `bufferPosition`,
/// and increment the `bufferPosition` with the byte size of the serialized value.
@usableFromInline
@inlinable
@_alwaysEmitIntoClient
@inline(__always)
internal func serialize(
_ value: UInt8,
at bufferPosition: inout ByteBufferPointer)