Skip to content

Commit a5030a6

Browse files
committed
stdlib: add a _unsafePerformance function which disable performance diagnostics in the passed closure.
1 parent 569a520 commit a5030a6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/swift/AST/SemanticAttrs.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,7 @@ SEMANTICS_ATTR(OBJC_FORBID_ASSOCIATED_OBJECTS, "objc.forbidAssociatedObjects")
115115

116116
SEMANTICS_ATTR(LIFETIMEMANAGEMENT_MOVE, "lifetimemanagement.move")
117117

118+
SEMANTICS_ATTR(NO_PERFORMANCE_ANALYSIS, "no_performance_analysis")
119+
118120
#undef SEMANTICS_ATTR
119121

stdlib/public/core/Misc.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,10 @@ public func _getTypeByMangledNameInContext(
118118
genericContext: UnsafeRawPointer?,
119119
genericArguments: UnsafeRawPointer?)
120120
-> Any.Type?
121+
122+
/// Prevents performance diagnostics in the passed closure.
123+
@_alwaysEmitIntoClient
124+
@_semantics("no_performance_analysis")
125+
public func _unsafePerformance<T>(_ c: () -> T) -> T {
126+
return c()
127+
}

0 commit comments

Comments
 (0)