@@ -475,7 +475,7 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedMandatoryRCParameterTest) {
475475 ASSERT_TRUE (Consumer->isSatisfied ());
476476}
477477
478- TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest ) {
478+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalDTParameterTest ) {
479479 // This test will check that the parsing fails due the same optional
480480 // parameter being specified multiple times
481481 const llvm::StringLiteral Source = R"cc(
@@ -499,6 +499,32 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest) {
499499 ASSERT_TRUE (Consumer->isSatisfied ());
500500}
501501
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+
502528TEST_F (ParseHLSLRootSignatureTest, InvalidLexOverflowedNumberTest) {
503529 // This test will check that the lexing fails due to an integer overflow
504530 const llvm::StringLiteral Source = R"cc(
0 commit comments