@@ -475,7 +475,7 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedMandatoryRCParameterTest) {
475
475
ASSERT_TRUE (Consumer->isSatisfied ());
476
476
}
477
477
478
- TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest ) {
478
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalDTParameterTest ) {
479
479
// This test will check that the parsing fails due the same optional
480
480
// parameter being specified multiple times
481
481
const llvm::StringLiteral Source = R"cc(
@@ -499,6 +499,32 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest) {
499
499
ASSERT_TRUE (Consumer->isSatisfied ());
500
500
}
501
501
502
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalRCParameterTest) {
503
+ // This test will check that the parsing fails due the same optional
504
+ // parameter being specified multiple times
505
+ const llvm::StringLiteral Source = R"cc(
506
+ RootConstants(
507
+ visibility = Shader_Visibility_All,
508
+ b0, num32BitConstants = 1,
509
+ visibility = Shader_Visibility_Pixel
510
+ )
511
+ )cc" ;
512
+
513
+ TrivialModuleLoader ModLoader;
514
+ auto PP = createPP (Source, ModLoader);
515
+ auto TokLoc = SourceLocation ();
516
+
517
+ hlsl::RootSignatureLexer Lexer (Source, TokLoc);
518
+ SmallVector<RootElement> Elements;
519
+ hlsl::RootSignatureParser Parser (Elements, Lexer, *PP);
520
+
521
+ // Test correct diagnostic produced
522
+ Consumer->setExpected (diag::err_hlsl_rootsig_repeat_param);
523
+ ASSERT_TRUE (Parser.parse ());
524
+
525
+ ASSERT_TRUE (Consumer->isSatisfied ());
526
+ }
527
+
502
528
TEST_F (ParseHLSLRootSignatureTest, InvalidLexOverflowedNumberTest) {
503
529
// This test will check that the lexing fails due to an integer overflow
504
530
const llvm::StringLiteral Source = R"cc(
0 commit comments