Commit 465d1da
committed
[Modules] Add -cc1 -flate-module-map-file to load module maps after PCMs
If the same module map is passed to multiple compilation actions that
build PCMs and later load them, we currently create a new FileID for it
every time a PCM gets built.
This is not very problematic in terms of performance, but it causes us
to waste source location space when those PCMs get loaded together: the
module map will take source location space in each of the PCMs,
effectively multiplying the space it takes by the number of PCMs that we
load.
PR #83660 has inadvertenly caused more PCMs to be loaded in our internal
builds and some actions tipped over the source location limit.
To provide a workaround, introduce an option to load module maps after
PCMs and ensure we reuse existing FileID if it's available. This allows
to reduce the source location space taken by module maps because we will
use an existing FileID from some loaded PCM instead of creating a new
one each time.
There are probably some holes in the approach for more complicated uses.
In particular:
- It is unclear how the module map shadowing rules are affected.
- Code replaying AST files is not aware of the new option and will keep
using `fmodule-map-file`, it is unclear whether this acutally causes
any issues
- ModuleDepCollector does not distinguish betwee late and non-late
module maps.
The new flag is `-cc1` for now to allow providing a quick workaround
for our builds in the wake of #83660 without figuring out all the
details. I plan to start a follow up discussion on Discourse to see if
this flag should be promoted to Clang flag or if there are alternative
solutions that avoid wasting the source location space in duplicate
module maps.1 parent 92e96c7 commit 465d1da
File tree
7 files changed
+120
-4
lines changed- clang
- include/clang
- Driver
- Frontend
- lib
- Frontend
- Rewrite
- Lex
- Tooling/DependencyScanning
- test/Modules
7 files changed
+120
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3179 | 3179 | | |
3180 | 3180 | | |
3181 | 3181 | | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
3182 | 3188 | | |
3183 | 3189 | | |
3184 | 3190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
539 | 542 | | |
540 | 543 | | |
541 | 544 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
923 | | - | |
| 922 | + | |
924 | 923 | | |
925 | 924 | | |
926 | 925 | | |
927 | 926 | | |
928 | 927 | | |
929 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
930 | 933 | | |
931 | 934 | | |
932 | 935 | | |
| |||
1038 | 1041 | | |
1039 | 1042 | | |
1040 | 1043 | | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1041 | 1049 | | |
1042 | 1050 | | |
1043 | 1051 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3130 | 3130 | | |
3131 | 3131 | | |
3132 | 3132 | | |
3133 | | - | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
3134 | 3137 | | |
3135 | 3138 | | |
3136 | 3139 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
0 commit comments