<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/98192>98192</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Split up the HLSLResource attribute
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            metabug,
            HLSL
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bogner
      </td>
    </tr>
</table>

<pre>
    The [HLSLResource attribute](https://github.com/llvm/llvm-project/blob/release/18.x/clang/include/clang/Basic/Attr.td#L4336) is currently used to represent resource related information in the AST for lowering and diagnostic purposes. It is unspellable and it's attached to resource types like RWBuffer and RasterizerOrderedBuffer when they're created in HLSLExternalSemaSource.

As we move towards using intangible types for handles (See #90631, #97362), we want to work towards a model where this attribute is no longer monolithic and applies to the handle itself. A few possibly incomplete examples:
```c++
template <typename T> class RWBuffer {
  [[clang::hlsl_contained_type(T)]]
 [[clang::hlsl_is_rov(false)]]
  [[clang::hlsl_resource_class(uav)]]
 __hlsl_resource_t Handle;
};

template <typename T> class ConstantBuffer {
  [[clang::hlsl_resource_class(cbuffer)]]
 __hlsl_resource_t Handle;
}

template <typename T> class Texture2D {
  [[clang::hlsl_texture_dimension(...)]]
 [[clang::hlsl_resource_class(srv)]]
  __hlsl_resource_t Handle;
}
```

To get there, we need to do a few things:
- [ ] Split [[clang::hlsl_resource_class]] out of the HLSLResource attribute
- [ ] Split [[clang::hlsl_is_rov]] out of the HLSLResource attribute
- [ ] Move resource class / ROV attributes to resource's handles instead of the class itself
- [ ] Define attributes for texture type and dimension
- [ ] Remove HLSLResource

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU1v4zYQ_TXjy2AFmbL8cfDBjtfYAlssEBvt0aCkkcQuRQrkKE766wtSdpxNum2ygJBQMt_Mm5nHR-m9agzRGvIt5LuJHLi1bl3YxpCbFLZ6Wh9bQs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