Skip to content

Commit e1289c1

Browse files
committed
add testcase to demonstrate source location
1 parent b9d40cb commit e1289c1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -verify
2+
// RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s 2>&1 | FileCheck %s
23

34
// expected-note@+2 {{overlapping resource range here}}
45
// expected-error@+1 {{resource ranges b[42;42] and b[42;42] overlap within space = 0 and visibility = All}}
@@ -76,3 +77,29 @@ void bad_root_signature_12() {}
7677
// expected-error@+1 {{resource ranges s[2;2] and s[2;2] overlap within space = 0 and visibility = Vertex}}
7778
[RootSignature("StaticSampler(s2, visibility=SHADER_VISIBILITY_ALL), DescriptorTable(Sampler(s2), visibility=SHADER_VISIBILITY_VERTEX)")]
7879
void valid_root_signature_13() {}
80+
81+
#define DemoNoteSourceLocations \
82+
"DescriptorTable( " \
83+
" CBV(b4, numDescriptors = 4), " \
84+
" SRV(t22, numDescriptors = 1), " \
85+
" UAV(u42, numDescriptors = 2), " \
86+
" CBV(b9, numDescriptors = 8), " \
87+
" SRV(t12, numDescriptors = 3), " \
88+
" UAV(u3, numDescriptors = 16), " \
89+
" SRV(t9, numDescriptors = 1), " \
90+
" CBV(b1, numDescriptors = 2), " \
91+
" SRV(t17, numDescriptors = 7), " \
92+
" UAV(u0, numDescriptors = 3), " \
93+
")"
94+
95+
// CHECK: note: expanded from macro 'DemoNoteSourceLocations'
96+
// CHECK-NEXT: [[@LINE-5]] | " SRV(t17, numDescriptors = 7), " \
97+
// CHECK-NEXT: | ^
98+
// CHECK: note: expanded from macro 'DemoNoteSourceLocations'
99+
// CHECK-NEXT: [[@LINE-15]] | " SRV(t22, numDescriptors = 1), "
100+
// CHECK-NEXT: | ^
101+
102+
// expected-note@+2 {{overlapping resource range here}}
103+
// expected-error@+1 {{resource ranges t[17;23] and t[22;22] overlap within space = 0 and visibility = All}}
104+
[RootSignature(DemoNoteSourceLocations)]
105+
void bad_root_signature_14() {}

0 commit comments

Comments
 (0)