[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 10:49:41 PDT 2024


================
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
+
+// This test validates the diagnostics that are emitted when a variable with a "resource" type
+// is bound to a register using the register annotation
+
+/*
+template<typename T>
+struct [[hlsl::resource_class(SRV)]] MyTemplatedSRV {
+  T x;
+};
+
+struct [[hlsl::resource_class(SRV)]] MySRV {
+  int x;
+};
+
+struct [[hlsl::resource_class(Sampler)]] MySampler {
+  int x;
+};
+
+struct [[hlsl::resource_class(UAV)]] MyUAV {
+  int x;
+};
+
+struct [[hlsl::resource_class(CBuffer)]] MyCBuffer {
+  int x;
+};
+*/ 
----------------
bob80905 wrote:

Forgot to remove the commented block.
Correct, there are currently no examples that match that look. I believe this is something I expect @hekota to change (applying attributes to the handle type rather than the handle variable), and then I can retroactively update these tests. 

https://github.com/llvm/llvm-project/pull/97103


More information about the cfe-commits mailing list