Skip to content

Commit d66562c

Browse files
Merge pull request #38729 from varungandhi-apple/vg-tweak-docs
[docs] Make some corrections and additions to UnderscoredAttributes.md
2 parents 319b3e6 + 2c9358b commit d66562c

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

docs/ReferenceGuides/UnderscoredAttributes.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ Most notably, default argument expressions are implicitly
3939
`@_alwaysEmitIntoClient`, which means that adding a default argument to a
4040
function which did not have one previously does not break ABI.
4141

42+
## `@_assemblyVision`
43+
44+
Forces emission of assembly vision remarks for a function or method, showing
45+
where various runtime calls and performance impacting hazards are in the code
46+
at source level after optimization.
47+
48+
Adding this attribute to a type leads to remarks being emitted for all methods.
49+
4250
## `@_borrowed`
4351

4452
Indicates that the [conservative access pattern](/docs/Lexicon.md#access-pattern)
@@ -95,15 +103,15 @@ extension Text {
95103
}
96104
```
97105

98-
## `@_dynamicReplacement(for:)`
106+
## `@_dynamicReplacement(for: targetFunc(label:))`
99107

100108
Marks a function as the dynamic replacement for another `dynamic` function.
101109
This is similar to method swizzling in other languages such as Objective-C,
102110
except that the replacement happens at program start (or loading a shared
103111
library), instead of at an arbitrary point in time.
104112

105113
For more details, see the forum post on
106-
[Dynamic method replacement](https://forums.swift.org/t/dynamic-method-replacement/16619).
114+
[dynamic method replacement](https://forums.swift.org/t/dynamic-method-replacement/16619).
107115

108116
## `@_distributedActorIndependent`
109117

@@ -134,7 +142,7 @@ This attribute is most commonly used by overlays.
134142

135143
```swift
136144
// module M
137-
func f() {}
145+
public func f() {}
138146

139147
// module N
140148
@_exported import M
@@ -270,11 +278,6 @@ of the closure. This is different from the typical behavior, where the closure
270278
may be runnable anywhere unless its type specifically declares that it will
271279
run on a specific actor.
272280

273-
This new attribute can be used on parameters of `@Sendable async` type
274-
to indicate that the closures arguments passed to such parameters
275-
should inherit the actor context where they are formed, which is not
276-
the normal behavior for `@Sendable` closures.
277-
278281
## `@_inheritsConvenienceInitializers`
279282

280283
An attribute that signals that a class declaration inherits its convenience
@@ -289,7 +292,6 @@ Indicates that a protocol is a marker protocol. Marker protocols represent some
289292
meaningful property at compile-time but have no runtime representation.
290293

291294
For more details, see [SE-0302](https://github.com/apple/swift-evolution/blob/main/proposals/0302-concurrent-value-and-concurrent-closures.md#marker-protocols), which introduces marker protocols.
292-
293295
At the moment, the language only has one marker protocol: `Sendable`.
294296

295297
Fun fact: Rust has a very similar concept called

include/swift/AST/Attr.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ SIMPLE_DECL_ATTR(_assemblyVision, EmitAssemblyVisionRemarks,
670670
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
671671
120)
672672

673+
// If you're adding a new underscored attribute here, please document it in
674+
// docs/ReferenceGuides/UnderscoredAttributes.md.
675+
673676
#undef TYPE_ATTR
674677
#undef DECL_ATTR_ALIAS
675678
#undef CONTEXTUAL_DECL_ATTR_ALIAS

0 commit comments

Comments
 (0)