<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126257>126257</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL][clang-format] Add Language Mode for HLSL
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format,
HLSL
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
V-FEXrt
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
V-FEXrt
</td>
</tr>
</table>
<pre>
clang-format supports many different languages and as part of that support it can switch between different languages to add/remove formatting rules. Right now clang-format can fairly reasonably format HLSL running under C++ mode however annotation syntax could use better support.
Adding an HLSL mode is the first step in supporting HLSL specific formatting rules.
Automatically determining HLSL as the source language is a downstream task that may or may not actually be possible. Plenty of HLSL programs will not have obvious differences from C++ so autodetection may have to be limited to huristics or file extension. This is still an open design question.
AC:
- A test in the flavor of [this one](https://github.com/llvm/llvm-project/blob/247430e9c41c61b66e2ee95c29a05de3e24c19b9/clang/test/Format/dump-config-objc-stdin.m) verifies language mode is HLSL
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVLGO6zYQ_Bq6WdiQKEs-FSrsdxFSXIAgCYK0FLmS-EKRCndpP_99QJ19l4ekSUXY4MzszFCriOzkETtRX4SUv-_7H_6ILKQU9etOJZ5D7B5_7oZg7p12yk_7McRFMVBa1xCZYFH-DsaOI0b0DPlOUhMSKG9AEawqMoQReP5EgWXQygPdLOsZBuQbov9PFg6gjBGyj7iEK8K7PFs_QUwO6QC_2Glm8OEG3w2Y-Udlo7tDREXBq8HdH3D48e3XN4jJ-8yTvMEIX4S8CHmBJRiEOdzwihGU94EV2-CB7p7VN9AhOQOJME_NGJ-WDqI4i-J8NiZTKv8usZFZAp4RRhuJgRhXsP4Jy5e3m7SitqPV_zb4IE4cFsVWK-fuYJAxLtZ_wNW7BoUUNX7El6UVmHDzxBHVAqzoz_cmFnWHELfDBwalOW3MA8IaiOzg8AA_O_R8z-1tImsMU1QLwc06t8FmdUUIw9WGRB_1aSQYY1g-IqUAKnHIQ-sty6y6QTlkQWcXy2jyrzlFS2w15eFG6xDwG6MnG_wBfpstZUvEWV95CGt-NZjfMfyVkDL5I68c2RdR5RNgD2dgJM7Bb1U4dQ0x-xL1hTNr8CjqVyFfZuaVMk72QvaT5TkNBx0WIXvnrs9jv8bwFTUL2Q8uDEL28ng6VgW2-ljqphyaBiViW2vZqqI2WKE86rIdWiH77ZkK2eeJhOz7rXAhe5OWda-DH-20D8NXvSc21h8WIVu4YrSjRfqs9vm0tmZ2pqtMW7Vqh115ql7aY121cjd3L7o8DXo8lqVsqrIqG6OM0nX50pTjqTH1znaykHUhi1PZyKosDnLQzTg0epAtan1EcSxwUdYdsu9DiNPOEiXsStnI-rRzakBHjx3yzw8wLxL5RUiZB3xsldht4Q1pInEsnCWmT1q27LZltAHqV1FfvuOrX-FsDLw9A_gpBzCGuCWwS9F1_7u7zQkJ2T_MXDv5dwAAAP__yMO56A">