[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 16:08:23 PDT 2024


================
@@ -1698,18 +1698,27 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
   return true;
 }
 
-static bool CheckArgsTypesAreCorrect(
+bool CheckArgTypeIsCorrect(
+    Sema *S, Expr *Arg, QualType ExpectedType,
+    llvm::function_ref<bool(clang::QualType PassedType)> Check) {
+  QualType PassedType = Arg->getType();
+  if (Check(PassedType)) {
+    if (auto *VecTyA = PassedType->getAs<VectorType>())
+      ExpectedType = S->Context.getVectorType(
+          ExpectedType, VecTyA->getNumElements(), VecTyA->getVectorKind());
+    S->Diag(Arg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+        << PassedType << ExpectedType << 1 << 0 << 0;
+    return true;
+  }
+  return false;
+}
+
+bool CheckArgsTypesAreCorrect(
----------------
farzonl wrote:

This function reads werid I think the intent was `CheckArgTypesAreCorrect`. Both `Args` and `Types` don't need to be plural.  But now that we have a singular version`CheckArgTypeIsCorrect`  Maybe adding an All in the name would be better for distinguishing it.
```suggestion
bool CheckAllArgTypesAreCorrect(
```
or
```suggestion
bool CheckAllArgTypeCorrectness(
```

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


More information about the llvm-commits mailing list