[clang] Reapply "[HLSL] Rewrite semantics parsing" (#157718) (PR #158044)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 24 06:11:13 PDT 2025
================
@@ -118,6 +118,46 @@ static void fixSeparateAttrArgAndNumber(StringRef ArgStr, SourceLocation ArgLoc,
Slot = new (Ctx) IdentifierLoc(ArgLoc, PP.getIdentifierInfo(FixedArg));
}
+Parser::ParsedSemantic Parser::ParseHLSLSemantic() {
+ assert(Tok.is(tok::identifier) && "Not a HLSL Annotation");
+
+ // Semantic pattern: [A-Za-z_]([A-Za-z_0-9]*[A-Za-z_])?[0-9]*
+ // The first part is the semantic name, the second is the optional
+ // semantic index. The semantic index is the number at the end of
+ // the semantic, including leading zeroes. Digits located before
+ // the last letter are part of the semantic name.
+ bool Invalid = false;
+ SmallString<256> Buffer;
+ Buffer.resize(Tok.getLength() + 1);
+ StringRef Identifier = PP.getSpelling(Tok, Buffer);
+ if (Invalid) {
----------------
Keenuts wrote:
Ah good catch, yes that's just some dead code probably left over from a refactoring.
Opened https://github.com/llvm/llvm-project/pull/164977
Thanks!
https://github.com/llvm/llvm-project/pull/158044
More information about the cfe-commits
mailing list