Skip to content

Commit 9ab1473

Browse files
committed
review: add missing register error
1 parent 1103a27 commit 9ab1473

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,28 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidMissingDTParameterTest) {
500500
ASSERT_TRUE(Consumer->isSatisfied());
501501
}
502502

503+
TEST_F(ParseHLSLRootSignatureTest, InvalidMissingRDParameterTest) {
504+
// This test will check that the parsing fails due a mandatory
505+
// parameter (register) not being specified
506+
const llvm::StringLiteral Source = R"cc(
507+
SRV()
508+
)cc";
509+
510+
TrivialModuleLoader ModLoader;
511+
auto PP = createPP(Source, ModLoader);
512+
auto TokLoc = SourceLocation();
513+
514+
hlsl::RootSignatureLexer Lexer(Source, TokLoc);
515+
SmallVector<RootElement> Elements;
516+
hlsl::RootSignatureParser Parser(Elements, Lexer, *PP);
517+
518+
// Test correct diagnostic produced
519+
Consumer->setExpected(diag::err_hlsl_rootsig_missing_param);
520+
ASSERT_TRUE(Parser.parse());
521+
522+
ASSERT_TRUE(Consumer->isSatisfied());
523+
}
524+
503525
TEST_F(ParseHLSLRootSignatureTest, InvalidMissingRCParameterTest) {
504526
// This test will check that the parsing fails due a mandatory
505527
// parameter (num32BitConstants) not being specified

0 commit comments

Comments
 (0)