<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142225>142225</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Main headers are ignored if priority is negative
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
EugeneZelenko
</td>
</tr>
</table>
<pre>
My work project coding style convention requires main header file to be last one. It means that all other headers must have negative priorities. But `IncludeCategoryManager::getIncludePriority` and `IncludeCategoryManager::getSortIncludePriority` ignore such headers.
I tried 19.1.1 and `main` (49d48c32e04742ebd05cbbd7dd544b1217b6d9d0)
Configuration:
```
IncludeCategories:
# C-Python header
- Regex: '^<Python\.h>$'
Priority: -6
CaseSensitive: true
# System headers
- Regex: '^<.+\.h>$'
Priority: -5
CaseSensitive: true
# STL headers
- Regex: '^<[a-z][a-z_]+>$'
Priority: -4
CaseSensitive: true
# Boost headers
- Regex: '^<boost/.+>$'
Priority: -3
CaseSensitive: true
# Qt headers
- Regex: '^<Q.+>$'
Priority: -2
CaseSensitive: true
# Local headers
- Regex: '^".+"$'
Priority: -1
CaseSensitive: true
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVMFu4zYQ_RrqMrBADSkpPuhgOzEQYAPsNj31UlDiWGKXJlOScut-fSFbTrCLLCzCgAnOPL55j_ZTMZreETWs3LLyMVNjGnxonsaeHP1Bltx3n7Ven5uXM_zjw3d4C_4v6hJ0XhvXQ0xnS9B5dyKXjHcQ6O_RBIpwVMbBQEpTgIOxBMlDS2BVTOAd5fCc4EjKRUiDSqCsBZ8GCjMmwnGMCQZ1InDUq2ROBG_B-GCSoZjDdkzAKv7sOjtq2qlEvQ_nF-VUT4GJDRObntJc_noFnlnFQTm9APjqw2dgML3zgSCO3XCbNGd8w_jmGVIwpKFY50Ve3GgmGyYgwwe51vKhE0hc1hKp1bzs2lbXWpdStgUWdVvpteYM19cbd94dTD8GNTk7TXY5ZRWfP3zzowhD8doFDAXsVl_PafC3R5iOYQW_UU__MrGBj8WwZuUTE7trPyt3-cDEE0M5Vfil9d0DsYFVNR_uVKRXctFMj3O9M4WRLtVpgtdzTHS82fTzAO-0OcPtXdJ5rcql3L9_-RXxJ8pZuVWr_1j5eN38Oe1wu2QeOdXuDbP1fvot3_GhnboY7vOF1GKhFd9-Sf2JE9-WsuMS4V98p-xidsQLOeIH-WfMxV3d73-RTDdCr8VaZdQUtXyopORlnQ1NUYjuILiuD6ik5g8k8FBrWbVaykrIOjMNcix5KTgi1qLKVdHyA5c1yjUVFS-Y5HRUxubWno65D31mYhypKSQilplVLdl4yVXEzirXrw4-HFWa5JWPWWgm3Kod-8gktyam-HFTMsleMvkHYPkILx-hGkEFmuNIgzncwvEMJr4nZjYG2wwpvV2CAfcM971Jw9jmnT8y3E-M89dqTnaG-4uQyHA_azk1-H8AAAD__5gL0MI">