[clang] [HLSL] Implement output parameter (PR #101083)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 14:58:17 PDT 2024


================
@@ -7071,6 +7071,93 @@ class ArraySectionExpr : public Expr {
   void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
 };
 
+/// This class represents temporary values used to represent inout and out
+/// arguments in HLSL. From the callee perspective these parameters are more or
+/// less __restrict__ T&. They are guaranteed to not alias any memory. inout
+/// parameters are initialized by the caller, and out parameters are references
+/// to uninitialized memory.
+///
+/// In the caller, the argument expression creates a temporary in local memory
+/// and the address of the temporary is passed into the callee. There may be
+/// implicit conversion sequences to initialize the temporary, and on expiration
+/// of the temporary an inverse conversion sequence is applied as a write-back
+/// conversion to the source l-value.
----------------
rjmccall wrote:

Somewhere in this declaration — either here or on the getter/setter pairs below — you need to actually document the structure of the sub-expressions.  That's needed whenever the sub-expressions don't obviously reflect the structure of the source code, which at minimum is true whenever an OVE is involved.

https://github.com/llvm/llvm-project/pull/101083


More information about the cfe-commits mailing list