Commit 7386a7e
committed
[Macros] Rework the way we assign closure and local discriminators
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.1 parent c3fbe24 commit 7386a7e
File tree
6 files changed
+66
-21
lines changed- include/swift/AST
- lib
- AST
- Sema
- test/Macros
6 files changed
+66
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | 345 | | |
350 | 346 | | |
351 | 347 | | |
| |||
1121 | 1117 | | |
1122 | 1118 | | |
1123 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1124 | 1127 | | |
1125 | 1128 | | |
1126 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
406 | 409 | | |
407 | 410 | | |
408 | 411 | | |
| |||
2185 | 2188 | | |
2186 | 2189 | | |
2187 | 2190 | | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
2188 | 2203 | | |
2189 | 2204 | | |
2190 | 2205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2934 | 2934 | | |
2935 | 2935 | | |
2936 | 2936 | | |
| 2937 | + | |
2937 | 2938 | | |
2938 | | - | |
| 2939 | + | |
2939 | 2940 | | |
2940 | 2941 | | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
2941 | 2957 | | |
2942 | 2958 | | |
2943 | 2959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1901 | 1901 | | |
1902 | 1902 | | |
1903 | 1903 | | |
| 1904 | + | |
1904 | 1905 | | |
1905 | | - | |
| 1906 | + | |
1906 | 1907 | | |
1907 | | - | |
1908 | | - | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1909 | 1913 | | |
1910 | | - | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
1911 | 1918 | | |
1912 | | - | |
1913 | | - | |
| 1919 | + | |
1914 | 1920 | | |
1915 | 1921 | | |
1916 | 1922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
414 | 413 | | |
415 | 414 | | |
416 | 415 | | |
| |||
436 | 435 | | |
437 | 436 | | |
438 | 437 | | |
439 | | - | |
| 438 | + | |
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
| |||
472 | 471 | | |
473 | 472 | | |
474 | 473 | | |
| 474 | + | |
475 | 475 | | |
476 | | - | |
| 476 | + | |
477 | 477 | | |
478 | | - | |
479 | | - | |
480 | | - | |
| 478 | + | |
481 | 479 | | |
482 | 480 | | |
483 | 481 | | |
| |||
494 | 492 | | |
495 | 493 | | |
496 | 494 | | |
497 | | - | |
498 | | - | |
499 | | - | |
| 495 | + | |
500 | 496 | | |
501 | 497 | | |
502 | 498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
0 commit comments