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

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Supported nested `cbuffer`s and other unusual constructs related to `cbuffer` declarations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    Make sure Clang supports `cbuffer` declaration uses that are allowed in DXC/FXC such as:
- nested `cbuffer` declarations
- multiple `cbuffer` declarations with the same name
- constants defined outside of `cbuffer` context (placed in `$Globals` constant buffer)
- namespace declarations inside `cbuffer` context
- function definitions inside `cbuffer` context

@tex3d put together an example that these various interesting cases here:
https://godbolt.org/z/E4cdx7xj8

Same shader with FXC:
https://shader-playground.timjones.io/39c0683735c0cd79b5970b5116765940

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8Fu5TYM_Br5QuRBlu1n--BDmtTtYXvKJVda4rOVlSVDorJv-_WF7RRFF-migABdZobkDIkp2dkTDaL5RTTPBWZeQhwW-hoYiymY78Mf-JUg5Ujw5NDPkPK2hcgJxFXqKd9uFMVVgiHtMCLb4CEnSsALMmAkQOfCNzJgPTy_Pgk1jq9PkLJeAJOoHoV8fABPicn8t2Q6UGt2bDdHP8HBN8sL8EKQcCXwuNJB1cEnRs8JDN2sJwMhc7KGINx-kNPBM90ZhOo2h_rsXFylUPVvLkzo0gfqEIQPourPQXCltKGmf3dl_VHr00IH75a9Prw72rP_i7W_WjLdKwNbZuAwEy8UAT3QHdfdqSMFXigRvGO0Ie-qTJESWz-Dxj2qhSKdSSzM2xGKGoUa52Cm4PgS4izU-KdQ46-1Nvf2_tad5V92j9OChuJp_Pj69JnQCXnYHH6fY8jeXNiub8FTutgg1Fj1Wl67qq0aLbVp-6npWzk1ZXltr01fSyEfCzNUpq96LGgo26pSjSxbVSyD7mlqVd3WeNN1293KupVIV5SdrNuausIOSqq6VLIqO6UadSlLfZWmU00n-6bqtaglrWjdxbn3dR-2sCllGsqya1RdOJzIpb8vJA476mHKcxK1dDZx-ofHlt1xS79_efkimmd4OY-FzKcbngC9gXBkln1OGd25VzFrThDJ4c7h8JOFL3J0ww-xWV7ydNFhFWrce_v4HrYY3kizUOMxYBJq_JjxfVB_BQAA__8Y7FRe">