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

    <tr>
        <th>Summary</th>
        <td>
            [[clang-format] Main header search algorithm should consider directories, not only file names
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            clang-format,
            clang:tooling
      </td>
    </tr>

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

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

<pre>
    Test case (`test/gui/application.cpp`):

```
#include "test/backend/application.h"
#include "test/gui/application.h"
```

Expected output:

```
#include "test/gui/application.h"
#include "test/backend/application.h"
```

Configuration:

```
BasedOnStyle: LLVM
```

I tried 19.1.1 and `main` (49d48c32e04742ebd05cbbd7dd544b1217b6d9d0).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUUk1r5DgU_DXyRcTIT5LbOvjQ-WhYSNjDLnvYmz5e25rIkpHkMPn3g5seZpJMYAYeGB7PVaWq0qX4KSKORN4Sed_orc4pjw_bhBH_x4DxOTUmudfxXyyVWl2QEhhIzyqWSuA0bZ7ASa9r8FZXn2Jr15X0jIAi_EjYZXp2HXYkwH20YXM7DlxBjLbPGN07oJkAfPbHR9rv1z9zsePD1xVtRUfTVtet_r6kzwn-_AFvJd2lePbTli83vxR0qwu6v-M_9TUg4Uf6-Pjf00ecv2jNHh3tVNu1HdXRUdKzRftIeraHJJQTg-WATBwEoHFMWmPcwTkphOmgO5jeKbdH1TZu5E5xpRscu4MYFDtIOTTziIIpOBvg3JwHLRUMHTpgWsnBgtKm8SMwkKxnAJyrbmiRC9n1lp-VUhYHQQTDRfvQhvCytClPjS9lw7ETIJlsgjYYyqV_ABhnHS0uGOvuHdwRABt0nG7OKS_63ZLwY00p-Djte3nf5HHnuDHbVIhgwZdafrBWX8O157dvMOU9fdI-0hm1w0wL6mxnqsOUsq_zQsuctuCoTbH4_cD5jLam7LEQuKMxVZpieKVnH5BGvWBpthzGuda17PnCae-Tr_NmWpsWAqdd0_Vzs-b0Be1eoosthcDp6szLCN8CAAD__-X4GWo">