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

    <tr>
        <th>Summary</th>
        <td>
            [HLSL][RootSignature] Incorrectly allows specifying parameters without a comma
        </td>
    </tr>

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

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

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

<pre>
    This issue tracks fixing a bug that allows parameters to be specified without an intermediate comma.

For instance:
```
RootFlags(0) CBV(b0)
```

Should be invalid because there is no comma between the two parameters.

This is because of the code pattern as follows:

https://github.com/llvm/llvm-project/blob/3c76a054ac4c7c93b197f3f1aec6c9f72ece1377/clang/lib/Parse/ParseHLSLRootSignature.cpp#L30-L42

It should be an else-if chain so that if we successfully parse the first element type, it will not attempt to parse any other element types right after.

Reproduction here: https://godbolt.org/z/arcExM9rE

AC:
- [ ] All occurrences of the if chains should be replaced with an else-if chain
- [ ] Add unit tests for this scenario
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlEFvrDYQxz-NuYyy8hpYlgOHTfJQn5RK1UvV-2AGcOu1kT1k3_bTV17YNElPlZBsjGeY-c1_BmM0oyNqRPkolDKuI2u0UEqUzxkuPPnQbIdZ5_tr8_tkIpgYFwIOqP-KMJifxo2A0C0j8IQMaK2_RJgx4JmYQgT20BHEmbQZDPVwMTz5hQEdGMcUztQbZALtz2fcCXkS8tT6AMZFRqdJ5OlEHOT2yNMP77m1OEahjlKoGp4e_xDq2KX9l6tCnl4nv9g-xWDcG1qTthqXSMATBQITwfn179ARX4hc-gJ88R_S2ALbELy78MPtrvY9wYzMFBxghMHfMGyhy9PEPN_eVCtUOxqelm6n_Vmo1tq3-_IwB_8naRaq7azvhGpzXR1QlgXqQle6zrt9XQ35sEfSB10PlSJN-7yqhGq1RTcmRyYZ_oYh0n395eX1JTF7NaNDXgLt9DwLlb_k8uGlUGuI3xniOyl0QDbSgxlAT2gcRL-W1wxwIYiL1hTjsFh7TYxWljCYEBnI0pkcA19nEuoJDMPFWAvOMyRC55mTJlYzdFfwqQ6fzCIEM04MODCFjfwPmoPvF83GO0iFE_kJvnD1fect73xIIP4WqsWgv_38tQ7fVh-np7UiDyDKRxDlM5ysBa_1EgI5TfFez3ve8QOTQLNFvQn4P4Q-e-17WJxhYIqc1BCAk3CiJofB-Kxv8r7Oa8yo2VflvpZFcSyzqanrqlZKVnpQdDyi1lqVh8OAuMe67waVmUZJVcpKVvuDPMpy11VK1kVVy1wfy8OxFoWkMxq7S4JKJLJbwzb7osrzKrPYkY1bxyddbO0empsAu2WMopDWRI7_emDD9jYlbgblsygfP8kppfzdaR8CabbX-wxYW_6aBsSHcfDe_mvLZUuwzf9uj1tOUah2S-utUf8EAAD__1JXlBY">