================ @@ -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(); ---------------- Icohedron wrote:
Hmm. Well the `CheckAllArgTypesAreCorrect` already checks element type if it's a vector. So I just need to replace the line ```c++ return !PassedType->hasIntegerRepresentation(); ``` with ```c++ return !PassedType->isBooleanType(); ``` or ```c++ return !S->Context.hasSameUnqualifiedType(PassedType, S->Context.BoolTy); ``` However, doing so results in an unexpected error when running the [`and.hlsl` codegen test](https://github.com/llvm/llvm-project/blob/ba50dda30d2b5f6670baef869983b3a104aa19b9/clang/test/CodeGenHLSL/builtins/and.hlsl): ``` ******************** TEST 'Clang :: CodeGenHLSL/builtins/and.hlsl' FAILED *************** ***** Exit Code: 2 Command Output (stderr): -- RUN: at line 2: /workspace/feature-and/build/bin/clang -cc1 -internal-isystem /workspace/feature-and/build/lib/clang/21/include -nostdsysteminc -finclude-default-header -triple dxil-pc-shadermodel6.3-library /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl -emit-llvm -O1 -o - | /workspace/feature-and/build/bin/FileCheck /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl + /workspace/feature-and/build/bin/clang -cc1 -internal-isystem /workspace/feature-and/build/lib/clang/21/include -nostdsysteminc -finclude-default-header -triple dxil-pc-shadermodel6.3-library /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl -emit-llvm -O1 -o - + /workspace/feature-and/build/bin/FileCheck /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl:23:14: error: passing 'bool2' (aka 'vector<bool, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(bool)))) bool' (vector of 2 'bool' values) 23 | return and(x, y); | ^ /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl:33:14: error: passing 'bool3' (aka 'vector<bool, 3>') to parameter of incompatible type '__attribute__((__vector_size__(3 * sizeof(bool)))) bool' (vector of 3 'bool' values) 33 | return and(x, y); | ^ /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl:43:14: error: passing 'bool4' (aka 'vector<bool, 4>') to parameter of incompatible type '__attribute__((__vector_size__(4 * sizeof(bool)))) bool' (vector of 4 'bool' values) 43 | return and(x, y); | ^ /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl:55:14: error: passing 'vector<bool, 4>' (vector of 4 'bool' values) to parameter of incompatible type '__attribute__((__vector_size__(4 * sizeof(bool)))) bool' (vector of 4 'bool' values) 55 | return and(x, y); | ^ /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl:67:14: error: passing 'vector<bool, 4>' (vector of 4 'bool' values) to parameter of incompatible type '__attribute__((__vector_size__(4 * sizeof(bool)))) bool' (vector of 4 'bool' values) 67 | return and(x, y); | ^ 5 errors generated. FileCheck error: '<stdin>' is empty. FileCheck command line: /workspace/feature-and/build/bin/FileCheck /workspace/feature-and/clang/test/CodeGenHLSL/builtins/and.hlsl -- ``` https://github.com/llvm/llvm-project/pull/127098 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits