You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Frontend] Add support for named target buffer in -verify expected lines
Clang, which heavily inspired Swift's -verify flag, supports naming
other files like so:
```
// [email protected]:11:22{{some error}}
```
Swift hasn't had the same need for this, because of the lack of textual
header inclusion (where the same header file can emit different
diagnostics depending on where it's included). The lack of this
functionality has made it impossible to use -verify in cases where
diagnostics are emitted in a macro however, since the expected-lines
can't be placed inside the generated macro buffer.
Now the main Swift file can refer to diagnostics inside these generated
buffers by naming the buffers. The generated names aren't pretty, but
the identifier is stable, unique and it works.
Here is an example of what it can look like:
```
// expected-error@@__swiftmacro_4main3bar.swift:10:15{{no exact matches in call to initializer}}
// expected-note@+1{{in expansion of macro 'foo' on global function 'bar' here}}
@foo
func bar() {}
```
The double "@" is a result of the buffer name starting with an @, which
is unfortunate but is how the mangling scheme works for macro buffer
names.
0 commit comments