================
@@ -1544,6 +1604,30 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned 
BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_select: {
+    if (SemaRef.checkArgCount(TheCall, 3))
+      return true;
+    QualType ArgTy = TheCall->getArg(0)->getType();
+    if (ArgTy->isBooleanType()) {
+      if (CheckBoolSelect(&SemaRef, TheCall))
+       return true;
+    } else if (ArgTy->isVectorType() &&
+              ArgTy->getAs<VectorType>()->getElementType()->isBooleanType()) {
+      if (CheckVectorSelect(&SemaRef, TheCall))
+       return true;
+    } else { // first operand is not a bool or a vector of bools.
+      SemaRef.Diag(TheCall->getArg(0)->getBeginLoc(),
+                  diag::err_typecheck_convert_incompatible)
+       << TheCall->getArg(0)->getType() << getASTContext().BoolTy
+       << 1 << 0 << 0;
+      SemaRef.Diag(TheCall->getArg(0)->getBeginLoc(),
+                  diag::err_builtin_non_vector_type)
+       << "First" << "__builtin_hlsl_select" << TheCall->getArg(0)->getType()
+       << TheCall->getArg(0)->getSourceRange();
+      return true;
----------------
damyanp wrote:

Wondering why this case doesn't also use a helper function and instead inlines 
the detection and diagnostic code here.

https://github.com/llvm/llvm-project/pull/107129
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to