<div dir="ltr">Ok, so Kadir's patch will very likely fix the problem. Please let us know if the issue persists.<div><br></div><div>Offtopic question: any reason (other than historical) why you're using the mirror instead of the official monorepo(<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>)?<a href="https://github.com/llvm/llvm-project"></a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 4, 2019 at 2:15 PM Stefan Lietzau <<a href="mailto:s.lietzau@tesis.de">s.lietzau@tesis.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="DE"><div class="gmail-m_462318865939660136WordSection1"><p class="MsoNormal"><span lang="EN-US">Hey Ilya,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">I was using commit ed4dbe63260f5a0a3410995b85b32f0ec34b0076 from the github llvm-mirror, dated 14 May 2019.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">During my debugging I noticed that this function (<a href="https://github.com/llvm-mirror/clang/blob/b84e04d4c031c8ff9a1a6875381f4a34b923cad7/lib/Lex/HeaderSearch.cpp#L1677" target="_blank"><span style="font-size:11pt;font-family:Calibri,sans-serif">https://github.com/llvm-mirror/clang/blob/b84e04d4c031c8ff9a1a6875381f4a34b923cad7/lib/Lex/HeaderSearch.cpp#L1677</span></a> ) tried to compare paths similar to these:<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">C:\foo/bar/baz with C:/foo/bar/baz. As these are compared as strings, they don’t match. I traced the problem back until I found that the compilation database entry contains only forward slashes while the suggested header contained backslashes. I’m not sure what the policy for path handling is for clang tooling and clangd in general. Without such information it’s difficult to fix this bug the right way.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><a href="mailto:kadircet@google.com" target="_blank"><span lang="EN-US">@Kadir Çetinkaya</span></a><span lang="EN-US">, to me it looks like your change should solve the issue, I’ll test it and report my findings later. Comparing the date from the commit I used to build locally with the date of your change, suggests to me that my build should have included your fix.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="color:rgb(31,73,125)">Kind regards,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">Stefan Lietzau</span></b><span lang="EN-US" style="color:rgb(31,73,125)"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10pt;font-family:Tahoma,sans-serif">Von:</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif"> Ilya Biryukov [mailto:<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a>] <br><b>Gesendet:</b> Dienstag, 4. Juni 2019 09:29<br><b>An:</b> Stefan Lietzau; Kadir Çetinkaya<br><b>Cc:</b> via clangd-dev<br><b>Betreff:</b> Re: [clangd-dev] Automatically adding includes always inserts the full path on windows<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi Stefan,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks for reporting this. I don't think any of the active clangd developers run on Windows, so bugs like this can easily go unnoticed.<u></u><u></u></p></div><div><p class="MsoNormal">To add to what Kadir was requesting, could you point to a particular point in code that does the string comparison? If some of the strings come from user input (e.g. flags to the compiler), we should definitely normalize them before comparisons. <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="mailto:kadircet@google.com" id="gmail-m_462318865939660136plusReplyChip-3" target="_blank">@Kadir Çetinkaya</a>, does your change also cover non-diagnostic use-cases? The function name looks very diagnostic-specific<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jun 3, 2019 at 8:20 PM Stefan Lietzau via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">Hi there,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">I’m using clangd with vscode on windows with the option to add includes when autocompleting symbols. However the inserted include is always absolute, even if the file is present in the include path (compile-commands.json generated by CMake). I tracked the problem down to a path comparison where one path coming from the compilation database contains forward slashes and the other path (header where the symbol definition was found) contains backslashes. Since this is a simple string comparison it fails and determines the header is not part of the include directories.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">I don’t think the best fix would be to convert the paths before comparison or use a better comparison. Instead I think this is something that needs to be fixed deep inside clang tooling. That means I think the paths returned by the compilation database should be in a predictable format.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">What do you guys think?</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Kind regards</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10pt;font-family:Arial,sans-serif">Stefan</span></b><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal">_______________________________________________<br>clangd-dev mailing list<br><a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><div><div><div><p class="MsoNormal">Regards,<u></u><u></u></p></div><div><p class="MsoNormal">Ilya Biryukov<u></u><u></u></p></div></div></div></div></div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,</div><div>Ilya Biryukov</div></div></div></div></div>