Commit a010f37
committed
[clang] Template Specialization Resugaring - TypeDecl
This is the introductory patch for a larger work which intends to solve the long standing C++ issue with losing type sugar when acessing template specializations. The well known example here is specializing a template with `std::string`, but getting diagnostics related to `std::basic_string<char>` instead. This implements a transform which, upon member access, propagates type sugar from the naming context into the accessed entity. It also implements a single use of this transform, resugaring access to TypeDecls. For more details and discussion see: https://discourse.llvm.org/t/rfc-improving-diagnostics-with-template-specialization-resugaring/64294 This is ready for review, although maybe not finished and there is some more stuff that could be done either here or in follow ups. * Its worth exploring if a global resugaring cache is worthwhile, besides the current operational cache. A global cache would be more expensive to index, so there is a tradeoff, and maybe should be used of the whole result of the operation, while keeping the existing cache for sub-results. * It would be ideal if the transform could live in ASTContext instead of Sema. There are a few dependencies that would have to be tackled. * Template arguments deduced for partial specializations. * Some kinds of type adjustments currently require Sema. Differential Revision: https://reviews.llvm.org/D1276951 parent 5b6f71b commit a010f37
File tree
17 files changed
+992
-35
lines changed- clang-tools-extra/clang-tidy/readability
- clang
- include/clang
- AST
- Sema
- lib
- AST
- Sema
- test
- AST
- CXX/temp/temp.param
- Sema/Resugar
- lldb/test/API/commands/expression/import-std-module/iterator
17 files changed
+992
-35
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1319 | 1319 | | |
1320 | 1320 | | |
1321 | 1321 | | |
1322 | | - | |
1323 | | - | |
1324 | 1322 | | |
1325 | 1323 | | |
1326 | 1324 | | |
| |||
1500 | 1498 | | |
1501 | 1499 | | |
1502 | 1500 | | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
1503 | 1504 | | |
1504 | 1505 | | |
1505 | 1506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | | - | |
| 649 | + | |
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
| 665 | + | |
666 | 666 | | |
667 | 667 | | |
668 | | - | |
| 668 | + | |
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| 808 | + | |
808 | 809 | | |
809 | 810 | | |
810 | 811 | | |
811 | 812 | | |
812 | 813 | | |
813 | | - | |
| 814 | + | |
814 | 815 | | |
815 | 816 | | |
816 | 817 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3193 | 3193 | | |
3194 | 3194 | | |
3195 | 3195 | | |
3196 | | - | |
| 3196 | + | |
| 3197 | + | |
3197 | 3198 | | |
3198 | 3199 | | |
3199 | 3200 | | |
| |||
13985 | 13986 | | |
13986 | 13987 | | |
13987 | 13988 | | |
| 13989 | + | |
| 13990 | + | |
13988 | 13991 | | |
13989 | 13992 | | |
13990 | 13993 | | |
| |||
14985 | 14988 | | |
14986 | 14989 | | |
14987 | 14990 | | |
14988 | | - | |
| 14991 | + | |
| 14992 | + | |
14989 | 14993 | | |
14990 | 14994 | | |
14991 | 14995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14075 | 14075 | | |
14076 | 14076 | | |
14077 | 14077 | | |
14078 | | - | |
14079 | | - | |
14080 | | - | |
| 14078 | + | |
14081 | 14079 | | |
14082 | 14080 | | |
14083 | 14081 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
647 | | - | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
648 | 649 | | |
649 | 650 | | |
650 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | | - | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | | - | |
| 538 | + | |
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| |||
9865 | 9866 | | |
9866 | 9867 | | |
9867 | 9868 | | |
9868 | | - | |
| 9869 | + | |
9869 | 9870 | | |
9870 | 9871 | | |
9871 | 9872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1246 | 1246 | | |
1247 | 1247 | | |
1248 | 1248 | | |
1249 | | - | |
| 1249 | + | |
1250 | 1250 | | |
1251 | 1251 | | |
1252 | 1252 | | |
| |||
0 commit comments