[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 13:28:42 PST 2024
================
@@ -784,6 +785,17 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) {
HLSLSV_DispatchThreadIDAttr(getASTContext(), AL));
}
+void SemaHLSL::handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL) {
+ auto *VD = cast<ValueDecl>(D);
+ if (!isLegalTypeForHLSLSV_ThreadOrGroupID(VD->getType())) {
+ Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_type)
+ << AL << "uint/uint2/uint3";
----------------
llvm-beanz wrote:
Since this is the same diagnostic as `SV_DispatchThreadID` (and others we haven't handled yet), maybe we should move the diagnostic into `isLegalTypeForHLSLSV_DispatchThreadID`, and change that function name to something like `diagnoseInputIDType`.
Then if the function returns false, this could just early out knowing the diagnostic came from the called function. That will reduce code duplication.
https://github.com/llvm/llvm-project/pull/115911
More information about the cfe-commits
mailing list