[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 13:02:38 PST 2025


================
@@ -51,6 +51,38 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID,
     TheCall->setType(RetTy);
     break;
   }
+  case SPIRV::BI__builtin_spirv_reflect: {
+    if (SemaRef.checkArgCount(TheCall, 2))
+      return true;
+
+    ExprResult A = TheCall->getArg(0);
+    QualType ArgTyA = A.get()->getType();
+    auto *VTyA = ArgTyA->getAs<VectorType>();
----------------
inbelic wrote:

Ah yes, they are in `SemaHLSL.cpp`. I would assume the entire `CheckArgTypeIsCorrect` and `CheckAllArgTypesAreCorrect` functions + helpers would be helpful here as well.

These diagnostics could be implemented using that. So I do think it would be worthwhile making those common.

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


More information about the llvm-commits mailing list