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

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 17:28:06 PDT 2024


================
@@ -5703,6 +5709,12 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity,
     Out << "E";
     break;
   }
+  case Expr::HLSLOutArgExprClass: {
+    const auto *OAE = cast<clang::HLSLOutArgExpr>(E);
+    Out << (OAE->isInOut() ? "_inout_" : "_out_");
+    mangleType(E->getType());
+    break;
+  }
----------------
rjmccall wrote:

Okay, so this is wrong in every way. :)

Expression mangling generally follows the syntax.  Since there is no argument-side syntax for passing an argument to an `out` or `inout` parameter, I'd say the correct mangling is just to ignore this node and mangle the underlying (syntactic) argument expression, which I assume is fairly easy to find (is that the base expression? whatever doesn't have the OVE still in it).

If it *were* important to mangle this for some reason, you would want to mangle it as a vendor extended expression, `u <source-name> <template-arg>* E`.

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


More information about the cfe-commits mailing list