Commit 15a45e2
committed
[Macros] Improve visitation of auxiliary decls
Use the same pattern as 'getAllMembers()'. This supports nested macro
expansion:
```
std::function<void(Decl *)> visit;
visit = [&](Decl *d) {
doIt(d);
d->visitAuxiliaryDecls(visit);
};
for (auto *d : decls)
visit(d);
```
Don't visit auxiliary decls in `PrintAST::visit(Decl *)` this function
is only intended for single decl printing. The caller should visit them
separately. For that, add
`ModuleDecl::getTopLevelDeclsWithAuxiliaryDecls()`
(cherry picked from commit 03bf349)1 parent 7492b74 commit 15a45e2
File tree
5 files changed
+33
-21
lines changed- include/swift/AST
- lib
- AST
- Frontend
5 files changed
+33
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
962 | 966 | | |
963 | 967 | | |
964 | 968 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1024 | 1024 | | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | 1027 | | |
1034 | 1028 | | |
1035 | 1029 | | |
| |||
4389 | 4383 | | |
4390 | 4384 | | |
4391 | 4385 | | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
4392 | 4394 | | |
4393 | 4395 | | |
4394 | 4396 | | |
4395 | 4397 | | |
4396 | 4398 | | |
4397 | | - | |
4398 | | - | |
| 4399 | + | |
4399 | 4400 | | |
4400 | 4401 | | |
4401 | 4402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1331 | 1331 | | |
1332 | 1332 | | |
1333 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
1334 | 1339 | | |
1335 | 1340 | | |
1336 | 1341 | | |
| |||
3060 | 3065 | | |
3061 | 3066 | | |
3062 | 3067 | | |
3063 | | - | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
3064 | 3071 | | |
3065 | 3072 | | |
3066 | 3073 | | |
| |||
4137 | 4144 | | |
4138 | 4145 | | |
4139 | 4146 | | |
| 4147 | + | |
| 4148 | + | |
| 4149 | + | |
| 4150 | + | |
| 4151 | + | |
| 4152 | + | |
| 4153 | + | |
4140 | 4154 | | |
4141 | 4155 | | |
4142 | 4156 | | |
4143 | 4157 | | |
4144 | | - | |
4145 | | - | |
4146 | | - | |
4147 | | - | |
| 4158 | + | |
4148 | 4159 | | |
4149 | 4160 | | |
4150 | 4161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4004 | 4004 | | |
4005 | 4005 | | |
4006 | 4006 | | |
4007 | | - | |
| 4007 | + | |
| 4008 | + | |
4008 | 4009 | | |
4009 | 4010 | | |
4010 | | - | |
4011 | | - | |
4012 | | - | |
4013 | | - | |
4014 | | - | |
| 4011 | + | |
4015 | 4012 | | |
4016 | | - | |
4017 | 4013 | | |
4018 | 4014 | | |
4019 | 4015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | | - | |
| 840 | + | |
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| |||
0 commit comments