Skip to content

Disallow swizzling on long vectors#7215

Merged
alsepkow merged 3 commits intomicrosoft:mainfrom
alsepkow:user/alsepkow/NoLongVecSwizzle
Mar 18, 2025
Merged

Disallow swizzling on long vectors#7215
alsepkow merged 3 commits intomicrosoft:mainfrom
alsepkow:user/alsepkow/NoLongVecSwizzle

Conversation

@alsepkow
Copy link
Copy Markdown
Contributor

@alsepkow alsepkow commented Mar 18, 2025

This PR addresses #7194 by adding a new error string in DiagnosticSemaKinds.td and emitting it in SemaHLSL.cpp.

@pow2clk implemented most of this in his fork. I'm just helping to finish it.

How verified:

  1. Several new test cases were added and verified locally
  2. Ran hcttest locally

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Copy Markdown
Collaborator

@llvm-beanz llvm-beanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, otherwise looks good.

Comment thread tools/clang/lib/Sema/SemaHLSL.cpp Outdated
@alsepkow alsepkow force-pushed the user/alsepkow/NoLongVecSwizzle branch from 0e6d803 to c050537 Compare March 18, 2025 01:08
Comment thread .github/workflows/clang-format-checker.yml Outdated
Comment thread .github/workflows/clang-format-checker.yml
@github-project-automation github-project-automation Bot moved this from New to In progress in HLSL Roadmap Mar 18, 2025
Copy link
Copy Markdown
Collaborator

@pow2clk pow2clk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!
If you add Fixes #7194 to the description, it will close the bug automatically

@alsepkow alsepkow merged commit 3ddf29b into microsoft:main Mar 18, 2025
12 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in HLSL Roadmap Mar 18, 2025
export TYPE lv_ctor(TYPE s) {
TYPE ret = (vector<TYPE,6>(1, 2, 3, 4, 5, s)).x; // expected-error {{invalid swizzle 'x' on vector of over 4 elements.}}
return ret;
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need an extra space here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra space where?

@alsepkow alsepkow deleted the user/alsepkow/NoLongVecSwizzle branch June 10, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants