[clang] [HLSL][Sema] Reject unsupported vector swizzles (PR #225286)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 20:46:04 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Farzon Lotfi (farzonl)

<details>
<summary>Changes</summary>

fixes #<!-- -->216199

This started out as rejecting swizzles for long vectors. But it turns out we did not remove opencl accessors so this change also does that.

HLSL vector swizzles are limited to the xyzw and rgba component sets and vectors of up to four elements.

---
Full diff: https://github.com/llvm/llvm-project/pull/225286.diff


4 Files Affected:

- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+2) 
- (modified) clang/lib/Sema/SemaExprMember.cpp (+14) 
- (modified) clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzleErrors.hlsl (+8) 
- (added) clang/test/SemaHLSL/Types/invalid-longvec-swizzle.hlsl (+11) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


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


More information about the cfe-commits mailing list