@@ -1401,6 +1401,112 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidStaticSamplerCommaTest) {
1401
1401
ASSERT_TRUE (Consumer->isSatisfied ());
1402
1402
}
1403
1403
1404
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRootDescriptorParamTest) {
1405
+ // This test will check that an error is produced when there is a invalid
1406
+ // value of a parameter
1407
+ const llvm::StringLiteral Source = R"cc(
1408
+ SRV(t0, invalid)
1409
+ )cc" ;
1410
+
1411
+ auto Ctx = createMinimalASTContext ();
1412
+ StringLiteral *Signature = wrapSource (Ctx, Source);
1413
+
1414
+ TrivialModuleLoader ModLoader;
1415
+ auto PP = createPP (Source, ModLoader);
1416
+
1417
+ SmallVector<RootSignatureElement> Elements;
1418
+ hlsl::RootSignatureParser Parser (RootSignatureVersion::V1_1, Elements,
1419
+ Signature, *PP);
1420
+
1421
+ // Test correct diagnostic produced
1422
+ Consumer->setExpected (diag::err_hlsl_invalid_token);
1423
+ ASSERT_TRUE (Parser.parse ());
1424
+
1425
+ ASSERT_TRUE (Consumer->isSatisfied ());
1426
+ }
1427
+
1428
+ TEST_F (ParseHLSLRootSignatureTest, InvalidDescriptorTableParamTest) {
1429
+ // This test will check that an error is produced when there is a invalid
1430
+ // value of a parameter
1431
+ const llvm::StringLiteral Source = R"cc(
1432
+ DescriptorTable(
1433
+ visibility = SHADER_VISIBILITY_ALL,
1434
+ invalid
1435
+ )
1436
+ )cc" ;
1437
+
1438
+ auto Ctx = createMinimalASTContext ();
1439
+ StringLiteral *Signature = wrapSource (Ctx, Source);
1440
+
1441
+ TrivialModuleLoader ModLoader;
1442
+ auto PP = createPP (Source, ModLoader);
1443
+
1444
+ SmallVector<RootSignatureElement> Elements;
1445
+ hlsl::RootSignatureParser Parser (RootSignatureVersion::V1_1, Elements,
1446
+ Signature, *PP);
1447
+
1448
+ // Test correct diagnostic produced
1449
+ Consumer->setExpected (diag::err_hlsl_invalid_token);
1450
+ ASSERT_TRUE (Parser.parse ());
1451
+
1452
+ ASSERT_TRUE (Consumer->isSatisfied ());
1453
+ }
1454
+
1455
+ TEST_F (ParseHLSLRootSignatureTest, InvalidDescriptorTableClauseParamTest) {
1456
+ // This test will check that an error is produced when there is a invalid
1457
+ // value of a parameter
1458
+ const llvm::StringLiteral Source = R"cc(
1459
+ DescriptorTable(
1460
+ CBV(invalid)
1461
+ )
1462
+ )cc" ;
1463
+
1464
+ auto Ctx = createMinimalASTContext ();
1465
+ StringLiteral *Signature = wrapSource (Ctx, Source);
1466
+
1467
+ TrivialModuleLoader ModLoader;
1468
+ auto PP = createPP (Source, ModLoader);
1469
+
1470
+ SmallVector<RootSignatureElement> Elements;
1471
+ hlsl::RootSignatureParser Parser (RootSignatureVersion::V1_1, Elements,
1472
+ Signature, *PP);
1473
+
1474
+ // Test correct diagnostic produced
1475
+ Consumer->setExpected (diag::err_hlsl_invalid_token);
1476
+ ASSERT_TRUE (Parser.parse ());
1477
+
1478
+ ASSERT_TRUE (Consumer->isSatisfied ());
1479
+ }
1480
+
1481
+ TEST_F (ParseHLSLRootSignatureTest, InvalidStaticSamplerParamTest) {
1482
+ // This test will check that an error is produced when there is a invalid
1483
+ // value of a parameter
1484
+ const llvm::StringLiteral Source = R"cc(
1485
+ StaticSampler(
1486
+ s0,
1487
+ filter = FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT,
1488
+ invalid,
1489
+ comparisonFunc = COMPARISON_EQUAL,
1490
+ )
1491
+ )cc" ;
1492
+
1493
+ auto Ctx = createMinimalASTContext ();
1494
+ StringLiteral *Signature = wrapSource (Ctx, Source);
1495
+
1496
+ TrivialModuleLoader ModLoader;
1497
+ auto PP = createPP (Source, ModLoader);
1498
+
1499
+ SmallVector<RootSignatureElement> Elements;
1500
+ hlsl::RootSignatureParser Parser (RootSignatureVersion::V1_1, Elements,
1501
+ Signature, *PP);
1502
+
1503
+ // Test correct diagnostic produced
1504
+ Consumer->setExpected (diag::err_hlsl_invalid_token);
1505
+ ASSERT_TRUE (Parser.parse ());
1506
+
1507
+ ASSERT_TRUE (Consumer->isSatisfied ());
1508
+ }
1509
+
1404
1510
TEST_F (ParseHLSLRootSignatureTest, InvalidVisibilityValueTest) {
1405
1511
// This test will check that an error is produced when there is a invalid
1406
1512
// value of a parameter
0 commit comments