Commit af24013
authored
[HLSL2021] Fix template parameter for buffer types (#4099)
This is a bit of an oddball situation caused by a two factors.
(1) We verify that template parameters for buffer types are complete
(2) The template expansion for the HLSL buffer types doesn't actually
require instantiation of the parameter type
We could, skip verification of template parameters, but doing so causes
the backend to crash because we need the buffer type expanded for code
generation. Skipping verification might work in some common cases, but
will fail if buffers are unused, and if nothing else forces the
instantiation.
The safe approach is to force instantiation ourselves, and that's what
this change does. Basically if the parameter of a buffer type is a
template specialization, we force the specialization to instantiate by
creating the specialization in the AST.
This allows us to continue verifing that the types are complete,
because after instantiation the template type is complete.1 parent cc50c79 commit af24013
2 files changed
Lines changed: 25 additions & 0 deletions
File tree
- tools/clang
- lib/Sema
- test/HLSLFileCheck/hlsl/template
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4830 | 4830 | | |
4831 | 4831 | | |
4832 | 4832 | | |
| 4833 | + | |
| 4834 | + | |
| 4835 | + | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
4833 | 4844 | | |
4834 | 4845 | | |
4835 | 4846 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments