aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
diff options
context:
space:
mode:
authorChris B <chris.bieneman@me.com>2024-04-01 12:10:10 -0500
committerGitHub <noreply@github.com>2024-04-01 12:10:10 -0500
commit9434c083475e42f47383f3067fe2a155db5c6a30 (patch)
tree99642518759d410d81b12f9bc23cf720aab8a229 /clang/lib/Edit/RewriteObjCFoundationAPI.cpp
parent92d0d6f6cb4099e651d066cd88dc0abfa6e612cf (diff)
downloadllvm-9434c083475e42f47383f3067fe2a155db5c6a30.zip
llvm-9434c083475e42f47383f3067fe2a155db5c6a30.tar.gz
llvm-9434c083475e42f47383f3067fe2a155db5c6a30.tar.bz2
[HLSL] Implement array temporary support (#79382)
HLSL constant sized array function parameters do not decay to pointers. Instead constant sized array types are preserved as unique types for overload resolution, template instantiation and name mangling. This implements the change by adding a new `ArrayParameterType` which represents a non-decaying `ConstantArrayType`. The new type behaves the same as `ConstantArrayType` except that it does not decay to a pointer. Values of `ConstantArrayType` in HLSL decay during overload resolution via a new `HLSLArrayRValue` cast to `ArrayParameterType`. `ArrayParamterType` values are passed indirectly by-value to functions in IR generation resulting in callee generated memcpy instructions. The behavior of HLSL function calls is documented in the [draft language specification](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf) under the Expr.Post.Call heading. Additionally the design of this implementation approach is documented in [Clang's documentation](https://clang.llvm.org/docs/HLSL/FunctionCalls.html) Resolves #70123
Diffstat (limited to 'clang/lib/Edit/RewriteObjCFoundationAPI.cpp')
-rw-r--r--clang/lib/Edit/RewriteObjCFoundationAPI.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
index 22f2c47e..81797c8 100644
--- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -1000,6 +1000,7 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
case CK_LValueToRValue:
case CK_NoOp:
case CK_UserDefinedConversion:
+ case CK_HLSLArrayRValue:
break;
case CK_IntegralCast: {