<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148972>148972</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clangd] Incorrect compile command heuristic in project with CUDA, HIP, and vanilla C++
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alexbaretta
</td>
</tr>
</table>
<pre>
I am using clangd in a project that combines the three dialects of C++ listed in the title. CMake is configured to produce the appropriate compile commands for each source file, but header files do not match one-to-one the source files, as the code is highly templatized, and most headers do not have a corresponding source. Therefore, for each header, clangd uses its heuristic match logic to pick a source file whose compile command will be used as the basis for to compute the compile command for the header. This logic however fails because, although LLVM supports both HIP and CUDA, LLVM does not have the necessary file types for CUDA and HIP headers, nor the logic to map them to their corresponding source file types.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU01v4zgM_TXyhWiQKHFdH3zoB4IpMAPMYXfvtMxY2pElQ6ST7f76hRQ37aJzkiHzPb73RCKzGwNRp-onVb9UuIiNqUNP__SYSASrPg5v3SvgBAu7MILxGMYBXACEOcW_yQiIRQETp94FYhBLIDYRweDQkxGGeIJnpZ-UfgLvWKjgS50TTxt4_oG_CByDieHkxiXRABIz_7AYKpU4zynOyaFQbjU7X84Jw8BwigkIjQWOSzIEJ-dJ6WfoFwFLOFAqVwxDhBAFJhRjIQa6k3gXw7XDJyxnMF6tmDgUadaN1r-B0DR7FPcvDaUoDDBFfm9z62DxTIBgYkrEcwxDzu7aYQN_WEp0iqlovGm_MuSrNeOFicEJg6UlORZnVuE-js6UgJz5BfhZOVxs5C8JwcV5Dz1lyuHdWI_srtFJLIBFaHX8f3ApsbQKzPIdrxpsvNA5p4vOM_RkcOHiCr3YuIwWvn__6wfwMs8xCUMfxcK3158lt-c_Xx5zbSkZIvFHcrldIEPMmN6uxuRtpqvcjCsEmWjNPfOEVectngnnfDHlb7Hk0m_f4xP9Rm0f1faxGrr90O5brKjbNbW-390f9k1lu5ZO_f3DQe817pu-bfu23h2aXU9bs78_1A-V6_RW19tmV-tdva-bDWFfY9Pqpn1oT83poA5bmtD5jffnaRPTWDnmhbrd4aFtdOWxJ89lHbUOdIHyV2mdtzN1GXTXLyOrwzYvEn_QlE3KwOvwqPoFXkOxa-TLi34MlAu3Lb44sbc3-fb68328zxic9_i-wdWSfGdFZlb7R6WPSh9HJ3bpNyZOSh-zovW4W6mVPhYfrPRxNXru9H8BAAD__9dki1I">