xref: /llvm-project/clang/test/ParserHLSL/hlsl_resource_class_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{{'resource_class' attribute cannot be applied to a declaration}}
4[[hlsl::resource_class(UAV)]] __hlsl_resource_t e0;
5
6// expected-error@+1{{'resource_class' attribute takes one argument}}
7__hlsl_resource_t [[hlsl::resource_class()]] e1;
8
9// expected-warning@+1{{ResourceClass attribute argument not supported: gibberish}}
10__hlsl_resource_t [[hlsl::resource_class(gibberish)]] e2;
11
12// expected-warning@+1{{attribute 'resource_class' is already applied with different arguments}}
13__hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(UAV)]] e3;
14
15// expected-warning@+1{{attribute 'resource_class' is already applied}}
16__hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(SRV)]] e4;
17
18// expected-error@+1{{'resource_class' attribute takes one argument}}
19__hlsl_resource_t [[hlsl::resource_class(SRV, "aa")]] e5;
20
21// expected-error@+1{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}}
22float [[hlsl::resource_class(UAV)]] e6;
23