Commit 7dd3ee5
Automerge: [Clang] remove qualifiers in getCanonicalTypeUnqualified (#170271)
It was assumed that since this is a method on Type, there are no quals
present because usually you get a Type by using operator-> on a
QualType. However, quals aren't always stored in the outermost QualType.
For example, if const A is used as a template parameter, the outer
QualType does not have the const flag set. The const actually lives in
the canonical type inside a SubstTemplateTypeParmType. We therefore need
to explicitly remove quals before returning.
Fixes #135273
---
I've been looking at all the call sites as suggested in
llvm/llvm-project#167881 (comment)
to check that their usage of this method is sane. So far, most of the
sites seem to either want unqualified types or not care, so this patch
should handle some spooky edge cases of those. Some of them need more
thinking, which I'll do soon.
Supersedes #167881File tree
3 files changed
+13
-1
lines changed- clang
- docs
- include/clang/AST
- test/SemaCXX
3 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1812 | 1812 | | |
1813 | 1813 | | |
1814 | 1814 | | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
1815 | 1820 | | |
1816 | 1821 | | |
1817 | 1822 | | |
| |||
1880 | 1885 | | |
1881 | 1886 | | |
1882 | 1887 | | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
1883 | 1893 | | |
1884 | 1894 | | |
1885 | 1895 | | |
| |||
0 commit comments