[llvm-branch-commits] [clang] [HLSL] Define the HLSLRootSignature Attr (PR #123985)

Sarah Spall via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 11 09:27:47 PST 2025


================
@@ -647,6 +648,40 @@ void SemaHLSL::emitLogicalOperatorFixIt(Expr *LHS, Expr *RHS,
       << NewFnName << FixItHint::CreateReplacement(FullRange, OS.str());
 }
 
+void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) {
+  if (AL.getNumArgs() != 1)
+    return;
+
+  StringRef Signature;
+  if (!SemaRef.checkStringLiteralArgumentAttr(AL, 0, Signature))
+    return;
+
+  SourceLocation Loc = AL.getArgAsExpr(0)->getExprLoc();
+  // FIXME: pass down below to lexer when fp is supported
+  // llvm::RoundingMode RM = SemaRef.CurFPFeatures.getRoundingMode();
+  SmallVector<hlsl::RootSignatureToken> Tokens;
+  hlsl::RootSignatureLexer Lexer(Signature, Loc, SemaRef.getPreprocessor());
+  if (Lexer.Lex(Tokens))
----------------
spall wrote:

This is a failure state? If the lexer returns true the lexing failed? Are error messages being produced?

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


More information about the llvm-branch-commits mailing list