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

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Constant buffer codegen crashes when `cbuffer` contains a class
        </td>
    </tr>

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

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

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

<pre>
    ```
class Foo {
  float x;
};

cbuffer cb {
    Foo foo;
}
RWBuffer<float> Buf : register(u0);

[numthreads(4,1,1)]
void main() {
      Buf[0] = foo.x;
}
```
https://godbolt.org/z/K87MTMzq5

The codegen crashes in `clang::CodeGen::HLSLBufferLayoutBuilder::layoutField` because the layout code is not handling classes, only structs.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcUsFupDgQ_ZriUkrLXcYNHDhA97IrbXLZjTRngw14xm1nsJ1J8vUjoCeJIoGgXFXP770qGYKZnNY1iBbEJZMpzn6pZ_3DR5n1Xr3WcGK3hzWDlSFg5z1C0QJrEEfrZcQX4GsIxeX2w5qhT-OoFxz691rcOkfvP6pZ89-3disEft6wgP-FbRoReIOLnkyIegEqEwOq3sFBtC5d47xoqQJQmQOdj_tbgVhhn71ReJXGAZVA1ScOuMKDaBmICwK_rIQOL58pfVY8x_gUgDdAHVA3edV7Gw9-mYC6N6Du37J4eHx4-yl2Yo-zxsErPWmHwyLDrAMah3Big5VuWoF4c_ZK_63dHvxz___97sC9fPUptslYtdqxJu121BltFZwY9nqQKWiMs8Y9tV2GJqDzEWfplDVuwm1MOgCd0Tv7iiEuaYjhkKmaq4pXMtP1schJHHNxKrK5zll_KquBS8GPpAop1LGqlB5zfSpLNY6ZqYmRYJwY8byi4kCkhMiPIxP5WJRCQM70VRp7sPb5uvqTmRCSro-cOKsyK3ttw7ZlRH2agAjoDESr_DUQl2yp1967Pk0BcmZNiOEDLZpoty3dGsQFz96FKF3EP3v2xfVfs9593_OrfYN3URoXUO4OZWmx9ZcBmzin_jD4K1C3Xn773D0t_rseIlC36QpA3U3ac02_AwAA___WifxK">