<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134502>134502</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Fix [File|Config]OptionsProvider::getOptions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/pull/121323 changed the way the absolute path is computed.
This led to `HeaderFilterRegex` not picked up from the `.clang-tidy` file sitting at the current working directory. This has partially been fixed by https://github.com/llvm/llvm-project/pull/133582, but nevertheless this should be fixed here as well.
Before the PR:
```
Getting options for file ''
AbsolutePath: /path/to/root/
```
After the PR:
```
Getting options for file ''
AbsolutePath: /path/to/root
```
I.e. there is a missing trailing slash. This makes the `addRawFileOptions` no longer work, because it does this:
```
StringRef RootPath = llvm::sys::path::parent_path(AbsolutePath);
```
Since the `AbsolutePath` no longer has a slash, instead of picking `/path/to/root` as `RootPath`, it picks `/path/to`, and there is no `.clang-tidy` file there.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VE2PpDYQ_TXuS2mRsRsaDhyYGZHklFFv7pHBBTjjxsgueqbz6yObHu1OZnNIpEiWKOH6eq-eS4VgpgWxYcUDK54OaqPZ-WZQ3rowKXvFP9dD7_StmYnWwGTLRMdENxmatz4b3IWJztrr--fL6t0fOBAT3bpZy0SXi1wKCcOslgk10Izwqm7pq_rg7EYIq6IZTIDBXdaNUGfAePvbbALYGOKAlfxnVBp9ZyyhP-OEb6zksDiC1QwvqGFbYfTukhKzkmeDVcv0hYy-RcfRWIRgiMwygaLkNWze40Lw6vxL_K2Nx4Gcv2UAqfisAqzKk1HW3qBHXGA0b6ihv8F_pkPKohJMPEK_ESx4RU8zWgwBKNYMs9ushh7vpWb0CCrAK1qbMd7u5wFH5zGheD7HLvaLkt8Pb3_CHatbybglwOj8TgITp3h4297Zf1Y0M9lC7DGaoiPHROedi23_LW2MGwn9_1_6U91fMsxiWY9RKgouJoRYhrwyNhrBqjBn--gu6gXDuxaU1mf12hmLv-4t7dIB65YJfZp_GggOagsIhkA73OfxQ4AAX8mbZTrjCGfnKMIAJp8gTV62TLbhFnZj3SEmK6rt9x1o9YECUTP58BnxV7MM-A7iQ8CH_qNM1Y4-wjBLIFQa3JieRmQmZvwBxSWPymIlfweR_B4jATEyfIrbr9Wiv81hcf_02pLLXbIH3Uhdy1odsMlPR1lVglfVYW6GU52f-kJrVZ6wPhUSpRpLnufqVPLqOB5MI7go-JEXeX3MRZWNNQohh6qWhZBFXrMjx4syNovkZ85PBxPChk0ujwUXB6t6tCGtNyG-61KIuO58k15pv02BHbk1gcK3PGTIpsX4XVjxBJ15A1Y8RDmx0-OjW0YzseLpLq1n765Go99nPiHd_x82b__9Dk1QQlobCc21EX8FAAD___7AzxM">