Commit feef80c
authored
[clang][tooling] Fix
When an expression is in a single macro argument but also contains a
macro, `getFileRange` would incorrectly reject that expression,
concluding that it came from two different macro arguments because they
came from two different expansions.
We adjust the logic to look at the full path of macro argument expansion
locations instead, tracking that if our traversal up the macro
expansions continues all the way through macro arguments all the way to
the top. This is similar to the technique used by `makeFileCharRange`.
We also add some test cases to ensure we don't introduce any false
positives.getFileRange false negative (llvm#171555)1 parent c4ff1f3 commit feef80c
File tree
2 files changed
+51
-23
lines changed- clang
- lib/Tooling/Transformer
- unittests/Tooling
2 files changed
+51
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | | - | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
510 | 511 | | |
511 | | - | |
| 512 | + | |
| 513 | + | |
512 | 514 | | |
513 | | - | |
| 515 | + | |
514 | 516 | | |
| 517 | + | |
515 | 518 | | |
516 | 519 | | |
517 | 520 | | |
518 | 521 | | |
519 | 522 | | |
520 | 523 | | |
| 524 | + | |
521 | 525 | | |
522 | 526 | | |
523 | 527 | | |
| |||
592 | 596 | | |
593 | 597 | | |
594 | 598 | | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
599 | 614 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
607 | 632 | | |
608 | 633 | | |
609 | 634 | | |
| |||
0 commit comments