[clang] [HLSL] Rewrite semantics parsing (PR #152537)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 9 05:16:40 PDT 2025
================
@@ -282,14 +327,17 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs,
return;
}
} break;
- case ParsedAttr::UnknownAttribute:
- Diag(Loc, diag::err_unknown_hlsl_semantic) << II;
- return;
- case ParsedAttr::AT_HLSLSV_GroupThreadID:
- case ParsedAttr::AT_HLSLSV_GroupID:
- case ParsedAttr::AT_HLSLSV_GroupIndex:
- case ParsedAttr::AT_HLSLSV_DispatchThreadID:
- case ParsedAttr::AT_HLSLSV_Position:
+ case ParsedAttr::AT_HLSLUnparsedSemantic: {
+ ASTContext &Ctx = Actions.getASTContext();
+ ArgExprs.push_back(IntegerLiteral::Create(
+ Ctx, llvm::APInt(Ctx.getTypeSize(Ctx.IntTy), Semantic.Index), Ctx.IntTy,
+ SourceLocation()));
+ ArgExprs.push_back(IntegerLiteral::Create(
+ Ctx, llvm::APInt(1, Semantic.Explicit), Ctx.BoolTy, SourceLocation()));
+ II = PP.getIdentifierInfo(Semantic.Name.upper());
----------------
Keenuts wrote:
Make sense, especially with the macro bit. Remove the `upper()` call and modify the code to make it work without. Also added a test case for the macro sample you shared.
https://github.com/llvm/llvm-project/pull/152537
More information about the cfe-commits
mailing list