[clang] [HLSL] Implement output parameter (PR #101083)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 14:58:05 PDT 2024
================
@@ -7071,6 +7071,102 @@ 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.
+///
+/// This AST node has three sub-expressions:
+/// - An OpaqueValueExpr with a source that is the argument lvalue expression.
+/// - An OpaqueValueExpr with a source that is a an implicit conversion
----------------
rjmccall wrote:
```suggestion
/// - An OpaqueValueExpr with a source that is an implicit conversion
```
Also, you should mention that this isn't evaluated for an `out` parameter.
https://github.com/llvm/llvm-project/pull/101083
More information about the cfe-commits
mailing list