[PATCH] D159247: [HLSL] Cleanup support for `this` as an l-value

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 31 00:32:05 PDT 2023


cor3ntin added a comment.

Thanks for working on this.
This is going to conflict with deducing this (https://reviews.llvm.org/D140828) in interesting (ie, horrible) ways, so i guess I'll have to deal with that.
For people following along we are trying to fix nasty lambda regression https://reviews.llvm.org/D159126, for which the present patch is needed so we probably needs to land the current patch before `deducing this`, which is less than ideal.

I do wonder if we do really need 3 functions though.

We ought to have `this` being either a pointer (C++), or a reference (HLSL), and the type of the object it points to.
It's unclear to me that we could not  just have 2 methods.

- getThisObjectType
- getThisType (as implemented in getThisArgType)

What would happen if we would:

- Make `getThisType` return a reference type (for HLSL)
- Explicitely remove the reference  where we need to

If that would be too verbose, maybe renaming would add some clarity
`getThisReferenceType` and `getThisType` - this would mirror what we do for deducing this (`getFunctionObjectParameterReferenceType` and `getFunctionObjectParameterType`)

Ultimately we can have:

- This being a pointer in C++
- This a reference in HLSL
- The object parameter being a reference or a pointer depending on whether it is explicit or not in C++23, or depending on whether we are using HLSL

Which is... not confusing at all !


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159247/new/

https://reviews.llvm.org/D159247



More information about the cfe-commits mailing list