[clang] [HLSL] Implement output parameter (PR #101083)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 15:38:10 PDT 2024
================
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions(
return;
}
+ if (auto *OutArgE = dyn_cast<HLSLOutArgExpr>(E)) {
+ // The base expression is only used to initialize the parameter for
+ // arguments to `inout` parameters, so we only traverse down the base
+ // expression for `inout` cases.
----------------
llvm-beanz wrote:
I should have commented on this. If SemaChecking traverses down both sides we get warnings for the conversion that would "initialize" the `out` parameter, but those warnings aren't accurate because no initialization occurs.
If we only traverse down the write back side we only get the warning for the copy back to the l-value, which is the behavior we want.
clang/test/SemaHLSL/Language/OutputParameters.hlsl verifies the behavior for `out` arguments of only diagnosing the write back conversion, removing the condition breaks that test by emitting diagnostics on the initialization as well.
https://github.com/llvm/llvm-project/pull/101083
More information about the cfe-commits
mailing list