[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 5 03:35:30 PST 2025


================
@@ -2393,8 +2395,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
     if (CheckVectorElementCallArgs(&SemaRef, TheCall))
       return true;
     if (SemaRef.BuiltinElementwiseTernaryMath(
-            TheCall, /*CheckForFloatArgs*/
-            TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
+            TheCall, /*ArgTyRestr*/
+            TheCall->getArg(0)->getType()->hasFloatingRepresentation()
+                ? Sema::EltwiseBuiltinArgTyRestriction::FloatTy
----------------
frasercrmck wrote:

The default "mode" for `BuiltinElementwiseTernaryMath` was `CheckForFloatArgs = true`, and it's now `EltwiseBuiltinArgTyRestriction::FloatTy` so we only need to update the cases where HLSL was ever passing `CheckForFloatArgs = false`.

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


More information about the cfe-commits mailing list