mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Setting closure and local discriminators depends on an in-order walk of the AST. For macros, it was walking into both macro expansions and arguments. However, this doesn't work well with lazy macro expansions, and could result in some closures/local variables not getting discriminators set at all. Make the assignment of discriminators only walk macro arguments, and then lazily assign discriminators for anything within a macro expansion or in ill-formed code. This replaces the single global "next autoclosure discriminator" scheme with a per-DeclContext scheme, that is more reliable/robust, although it does mean that discriminators of closures and locals within macro expansions are dependent on ordering. That shouldn't matter, because these are local values. Fixes rdar://108682196.
60 KiB
60 KiB