[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Update `setDefaultFlags` to account for Root Signature Version (PR #145828)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jul 3 11:40:18 PDT 2025
================
@@ -605,13 +608,159 @@ TEST_F(ParseHLSLRootSignatureTest, ValidTrailingCommaTest) {
hlsl::RootSignatureLexer Lexer(Source, TokLoc);
SmallVector<RootElement> Elements;
- hlsl::RootSignatureParser Parser(Elements, Lexer, *PP);
+ hlsl::RootSignatureParser Parser(DefVersion, Elements, Lexer, *PP);
+
+ // Test no diagnostics produced
+ Consumer->setNoDiag();
+
+ ASSERT_FALSE(Parser.parse());
+
+ ASSERT_TRUE(Consumer->isSatisfied());
+}
+
+TEST_F(ParseHLSLRootSignatureTest, ValidVersion10Test) {
+ // This test checks that the default values are set correctly
+ // when parsing with root signature version 1.0
+ const llvm::StringLiteral Source = R"cc(
+ CBV(b0),
+ SRV(t0),
+ UAV(u0),
+ DescriptorTable(
+ CBV(b1),
+ SRV(t1),
+ UAV(u1),
+ Sampler(s1),
+ )
+ )cc";
+
+ TrivialModuleLoader ModLoader;
+ auto PP = createPP(Source, ModLoader);
+ auto TokLoc = SourceLocation();
+
+ hlsl::RootSignatureLexer Lexer(Source, TokLoc);
+ SmallVector<RootElement> Elements;
+ auto Version = llvm::dxbc::RootSignatureVersion::V1_0;
+ hlsl::RootSignatureParser Parser(Version, Elements, Lexer, *PP);
----------------
bogner wrote:
Similarly, I think it's clearer to just pass the enum directly to the constructor here and below.
https://github.com/llvm/llvm-project/pull/145828
More information about the llvm-branch-commits
mailing list