Skip to content

Commit e07958a

Browse files
committed
add some additional error testing
1 parent e6373e0 commit e07958a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -verify
2+
3+
// This file mirrors the diagnostics testing in ParseHLSLRootSignatureTest.cpp
4+
// to verify that the correct diagnostics strings are output
5+
6+
// Lexer related tests
7+
8+
#define InvalidToken \
9+
"DescriptorTable( " \
10+
" invalid " \
11+
")"
12+
13+
[RootSignature(InvalidToken)] // expected-error {{unable to lex a valid Root Signature token}}
14+
void bad_root_signature_1() {}
15+
16+
#define InvalidEmptyNumber \
17+
"DescriptorTable( " \
18+
" CBV(t32, space = +) " \
19+
")"
20+
21+
[RootSignature(InvalidEmptyNumber)] // expected-error {{expected number literal is not a supported number literal of unsigned integer or integer}}
22+
void bad_root_signature_2() {}
23+
24+
#define InvalidOverflowNumber \
25+
"DescriptorTable( " \
26+
" CBV(t32, space = 98273498327498273487) " \
27+
")"
28+
29+
[RootSignature(InvalidOverflowNumber)] // expected-error {{provided unsigned integer literal '98273498327498273487' that overflows the maximum of 32 bits}}
30+
void bad_root_signature_3() {}
31+
32+
#define InvalidEOS \
33+
"DescriptorTable( "
34+
35+
// Parser related tests
36+
37+
[RootSignature(InvalidEOS)] // expected-error {{unexpected end to token stream}}
38+
void bad_root_signature_4() {}
39+
40+
#define InvalidTokenKind \
41+
"DescriptorTable( " \
42+
" DescriptorTable()" \
43+
")"
44+
45+
[RootSignature(InvalidTokenKind)] // expected-error {{expected the one of the following token kinds 'CBV, SRV, UAV, Sampler'}}
46+
void bad_root_signature_5() {}
47+
48+
#define InvalidRepeat \
49+
"DescriptorTable( " \
50+
" CBV(t0, space = 1, space = 2)" \
51+
")"
52+
53+
[RootSignature(InvalidRepeat)] // expected-error {{specified the same parameter 'space' multiple times}}
54+
void bad_root_signature_6() {}

0 commit comments

Comments
 (0)