[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 18:13:04 PST 2025


================
@@ -2079,6 +2079,14 @@ static bool CheckFloatingOrIntRepresentation(Sema *S, CallExpr *TheCall) {
                                     checkAllSignedTypes);
 }
 
+static bool CheckBoolRepresentation(Sema *S, CallExpr *TheCall) {
+  auto checkAllBoolTypes = [](clang::QualType PassedType) -> bool {
+    return !PassedType->hasIntegerRepresentation();
----------------
llvm-beanz wrote:

No, this is not correct. You want to check that the argument is either a `bool` type or a vector with element of `bool` type.

You'll want to use `S->Context.hasSameUnqualifiedType( S->Context.BoolTy, ...);`, and if the parameter is a vector you need to look at the element type.

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


More information about the cfe-commits mailing list