Commit d490526
[clangd] [Modules] Fixes to correctly handle module dependencies (#142090)
Simple module import dependencies, see
[module_dependencies.test](llvm/llvm-project@main...fleeting-xx:llvm-project:fix_clangd_dependent_modules#diff-5510681cbe5b7ed3a72c5e683184e83fa66e911e9abb0e6670b01b87b3ca7b1a),
were not being correctly handled due to a couple of issues.
- The `MDB.getRequiredModules()` call returned a
`std::vector<std::string>` and all `StringRefs` were to entries in that
temporary value. So the `StringRef` elements in
`getAllRequiredModules()`'s return value were bound to values that went
out of scope.
- `ModulesBuilder::ModulesBuilderImpl::getOrBuildModuleFile()` was
iterating over each module dependency name, but only using the original
module name and path for various checks and module compilation.
In addition to fixing the above issues I added support for Windows paths
in modules.test and added a new unit test, module_dependencies.test,
which demonstrates the failure in the previous state and works correctly
after the fixes have been applied.
Please let me know if I've missed anything.
Co-authored-by: Dan Baker <[email protected]>1 parent 2e82a17 commit d490526
File tree
3 files changed
+111
-18
lines changed- clang-tools-extra/clangd
- test
3 files changed
+111
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
430 | 429 | | |
431 | 430 | | |
432 | 431 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
437 | 436 | | |
438 | 437 | | |
439 | 438 | | |
440 | 439 | | |
441 | 440 | | |
442 | | - | |
| 441 | + | |
443 | 442 | | |
444 | 443 | | |
445 | 444 | | |
446 | 445 | | |
447 | | - | |
| 446 | + | |
448 | 447 | | |
449 | 448 | | |
450 | 449 | | |
| |||
494 | 493 | | |
495 | 494 | | |
496 | 495 | | |
497 | | - | |
| 496 | + | |
498 | 497 | | |
499 | 498 | | |
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
503 | | - | |
| 502 | + | |
504 | 503 | | |
505 | 504 | | |
506 | 505 | | |
507 | 506 | | |
508 | 507 | | |
509 | 508 | | |
510 | 509 | | |
| 510 | + | |
| 511 | + | |
511 | 512 | | |
512 | | - | |
| 513 | + | |
513 | 514 | | |
514 | 515 | | |
515 | 516 | | |
516 | | - | |
| 517 | + | |
517 | 518 | | |
518 | | - | |
| 519 | + | |
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 3 | | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
13 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments