@@ -431,7 +431,7 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedMandatoryParameterTest) {
431
431
ASSERT_TRUE (Consumer->isSatisfied ());
432
432
}
433
433
434
- TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest ) {
434
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalDTParameterTest ) {
435
435
// This test will check that the parsing fails due the same optional
436
436
// parameter being specified multiple times
437
437
const llvm::StringLiteral Source = R"cc(
@@ -455,6 +455,32 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest) {
455
455
ASSERT_TRUE (Consumer->isSatisfied ());
456
456
}
457
457
458
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalRCParameterTest) {
459
+ // This test will check that the parsing fails due the same optional
460
+ // parameter being specified multiple times
461
+ const llvm::StringLiteral Source = R"cc(
462
+ RootConstants(
463
+ visibility = Shader_Visibility_All,
464
+ b0, num32BitConstants = 1,
465
+ visibility = Shader_Visibility_Pixel
466
+ )
467
+ )cc" ;
468
+
469
+ TrivialModuleLoader ModLoader;
470
+ auto PP = createPP (Source, ModLoader);
471
+ auto TokLoc = SourceLocation ();
472
+
473
+ hlsl::RootSignatureLexer Lexer (Source, TokLoc);
474
+ SmallVector<RootElement> Elements;
475
+ hlsl::RootSignatureParser Parser (Elements, Lexer, *PP);
476
+
477
+ // Test correct diagnostic produced
478
+ Consumer->setExpected (diag::err_hlsl_rootsig_repeat_param);
479
+ ASSERT_TRUE (Parser.parse ());
480
+
481
+ ASSERT_TRUE (Consumer->isSatisfied ());
482
+ }
483
+
458
484
TEST_F (ParseHLSLRootSignatureTest, InvalidLexOverflowedNumberTest) {
459
485
// This test will check that the lexing fails due to an integer overflow
460
486
const llvm::StringLiteral Source = R"cc(
0 commit comments