xref: /llvm-project/clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl (revision b55c52c047a167f42abbde9a33356cfb96b82c7f)
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify
2
3// expected-error@+1{{'is_rov' attribute cannot be applied to a declaration}}
4[[hlsl::is_rov]] __hlsl_resource_t res0;
5
6// expected-error@+1{{HLSL resource needs to have [[hlsl::resource_class()]] attribute}}
7__hlsl_resource_t [[hlsl::is_rov]] res1;
8
9// expected-error@+1{{'is_rov' attribute takes no arguments}}
10__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(3)]] res2;
11
12// expected-error@+1{{use of undeclared identifier 'gibberish'}}
13__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(gibberish)]] res3;
14
15// expected-warning@+1{{attribute 'is_rov' is already applied}}
16__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] [[hlsl::is_rov]] res4;
17
18// expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}}
19// expected-error@+1{{attribute 'is_rov' can be used only on HLSL intangible type '__hlsl_resource_t'}}
20float [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] res5;
21