Commit 8209d53
authored
Fix static member call instantiation (#7377)
The first parameter of the HLSL_INTRINSIC record is actually a dummy
entry for the function name.
When builtin member function templates are instantiated, the 'this' ptr
is added as the first ParamVarDecl, which has the same index as the
first argument in the HLSL_INTRINSIC record.
This shifts the parameter names by one for static member functions, as
those do not have a 'this' pointer, as in:
```
| | | `-CXXMethodDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> used MakeMiss 'dx::HitObject (unsigned int, unsigned int, RayDesc)' static
| | | |-TemplateArgument type 'dx::HitObject'
| | | |-TemplateArgument type 'unsigned int'
| | | |-TemplateArgument type 'unsigned int'
| | | |-TemplateArgument type 'RayDesc'
| | | |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> MakeMiss 'unsigned int'
| | | |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> RayFlags 'unsigned int'
| | | |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> MissShaderIndex 'RayDesc'
```
The fix is the take the first actual parameter name of the
HLSL_INTRINSIC if a static member function template is declared.
Closes #73741 parent b4d773f commit 8209d53
4 files changed
Lines changed: 20 additions & 14 deletions
File tree
- tools/clang
- lib/Sema
- test
- CodeGenDXIL/hlsl/objects/HitObject
- SemaHLSL/hlsl/objects/HitObject
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5945 | 5945 | | |
5946 | 5946 | | |
5947 | 5947 | | |
| 5948 | + | |
| 5949 | + | |
5948 | 5950 | | |
5949 | 5951 | | |
5950 | 5952 | | |
| |||
6010 | 6012 | | |
6011 | 6013 | | |
6012 | 6014 | | |
| 6015 | + | |
| 6016 | + | |
| 6017 | + | |
| 6018 | + | |
6013 | 6019 | | |
6014 | | - | |
| 6020 | + | |
6015 | 6021 | | |
6016 | 6022 | | |
6017 | 6023 | | |
6018 | 6024 | | |
6019 | 6025 | | |
6020 | 6026 | | |
6021 | | - | |
| 6027 | + | |
6022 | 6028 | | |
6023 | 6029 | | |
6024 | 6030 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | | - | |
57 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments