================
@@ -1824,6 +1824,23 @@ static bool CheckAnyScalarOrVector(Sema *S, CallExpr
*TheCall,
return false;
}
+static bool CheckNotScalarType(Sema *S, CallExpr *TheCall, QualType Scalar,
+ unsigned ArgIndex) {
+ assert(TheCall->getNumArgs() >= ArgIndex);
+ QualType ArgType = TheCall->getArg(ArgIndex)->getType();
+ auto *VTy = ArgType->getAs<VectorType>();
+ // is the scalar or vector<scalar>
+ if (S->Context.hasSameUnqualifiedType(ArgType, Scalar) ||
+ (VTy &&
+ S->Context.hasSameUnqualifiedType(VTy->getElementType(), Scalar))) {
+ S->Diag(TheCall->getArg(0)->getBeginLoc(),
+ diag::err_typecheck_expect_scalar_or_vector_not_type)
+ << ArgType << Scalar;
+ return true;
+ }
+ return false;
+}
----------------
bogner wrote:
This function seems like it's being made generic in a way that isn't
particularly useful. Do we have cases where we reject a single specific scalar
type, and that that type is something other than bool?
Also, I find the error message kind of confusing:
```
invalid operand of type 'bool' where 'bool' or a vector of such type is not
allowed
```
This is redundant, isn't it? What information is this providing that "invalid
operand of type 'bool'" wouldn't?
https://github.com/llvm/llvm-project/pull/112400
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits