Commit c9d322e
authored
Merge pull request swiftlang#11774 from swiftlang/libcxxabi/template-tracking-to-21.x
[libcxxabi][ItaniumDemangle] Separate GtIsGt counter into more states
Currently `OutputBuffer::GtIsGt` is used to tell us if we're inside template arguments and have printed a '(' without a closing ')'. If so, we don't need to quote '<' when printing it as part of a binary expression inside a template argument. Otherwise we need to. E.g.,
```
foo<a<(b < c)>> // Quotes around binary expression needed.
```
LLDB's `TrackingOutputBuffer` has heuristics that rely on checking whether we are inside template arguments, regardless of the current parentheses depth. We've been using `isGtInsideTemplateArgs` for this, but that isn't correct. Resulting in us incorrectly tracking the basename of function like:
```
void func<(foo::Enum)1>()
```
Here `GtIsGt > 0` despite us being inside template arguments (because we incremented it when seeing '(').
This patch adds a `isInsideTemplateArgs` API which LLDB will use to more accurately track parts of the demangled name.
To make sure this API doesn't go untested in the actual libcxxabi test-suite, I changed the existing `GtIsGt` logic to use it. Also renamed the various variables/APIs involved to make it (in my opinion) more straightforward to understand what's going on. But happy to rename it back if people disagree.
Also adjusted LLDB to use the newly introduced API (and added a unit-test that would previously fail).
(cherry picked from commit 54c9ddd)File tree
6 files changed
+66
-24
lines changed- libcxxabi/src/demangle
- lldb
- source/Core
- unittests/Core
- llvm/include/llvm/Demangle
6 files changed
+66
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1366 | 1366 | | |
1367 | 1367 | | |
1368 | 1368 | | |
1369 | | - | |
| 1369 | + | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
| |||
1550 | 1550 | | |
1551 | 1551 | | |
1552 | 1552 | | |
1553 | | - | |
| 1553 | + | |
1554 | 1554 | | |
1555 | 1555 | | |
1556 | 1556 | | |
| |||
1824 | 1824 | | |
1825 | 1825 | | |
1826 | 1826 | | |
1827 | | - | |
| 1827 | + | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| |||
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
1888 | | - | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1889 | 1891 | | |
1890 | 1892 | | |
1891 | 1893 | | |
| |||
2061 | 2063 | | |
2062 | 2064 | | |
2063 | 2065 | | |
2064 | | - | |
| 2066 | + | |
2065 | 2067 | | |
2066 | 2068 | | |
2067 | 2069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
112 | 124 | | |
113 | 125 | | |
114 | | - | |
| 126 | + | |
| 127 | + | |
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
118 | | - | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
637 | 647 | | |
638 | 648 | | |
639 | 649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1366 | 1366 | | |
1367 | 1367 | | |
1368 | 1368 | | |
1369 | | - | |
| 1369 | + | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
| |||
1550 | 1550 | | |
1551 | 1551 | | |
1552 | 1552 | | |
1553 | | - | |
| 1553 | + | |
1554 | 1554 | | |
1555 | 1555 | | |
1556 | 1556 | | |
| |||
1824 | 1824 | | |
1825 | 1825 | | |
1826 | 1826 | | |
1827 | | - | |
| 1827 | + | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| |||
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
1888 | | - | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1889 | 1891 | | |
1890 | 1892 | | |
1891 | 1893 | | |
| |||
2061 | 2063 | | |
2062 | 2064 | | |
2063 | 2065 | | |
2064 | | - | |
| 2066 | + | |
2065 | 2067 | | |
2066 | 2068 | | |
2067 | 2069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
112 | 124 | | |
113 | 125 | | |
114 | | - | |
| 126 | + | |
| 127 | + | |
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
118 | | - | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
0 commit comments