-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clangd --query-driver doesn't seem to work with double slashes #62506
Comments
Ok, so using \\ instead of \ in the query-driver solves the problem Which... well.. isn't well documented anywhere. All everyone says is that it should match exactly what exists in compile_commands.json... which is \\. For anyone that got here. Don't double the backward slashes in --query-driver. Use only one backward slash.
Not Like:
|
@llvm/issue-subscribers-clangd |
Some similar issues are clangd/clangd#1518 and clangd/clangd#1605. Basically, clangd should ideally perform some sort of path normalization on the value of |
Yes, I'm aware there are issues with both solutions: doing more than a plain string comparison and doing only it. However, I do think it's a good idea to give an example of a Windows path in the query-driver section. That's because, in Windows, copying the path found in compile_commands.json is not enough. That path uses \ as a escape character for \, and this isn't needed in the query-driver option itself. If someone were to take a look at the example, they would find it out in an faster way. |
I'm supportive of adding such an example. Are you interested in submitting a documentation patch? The source file is https://github.com/llvm/clangd-www/blob/main/guides/system-headers.md |
I most definitely am! I will take a look at the contribution guide as soon as I have the time and try to submit a documentation patch. Thank you for the source file reference. |
For the record, the That said, #66757 will accidentally make the |
Hello there!
I've got some issues on setting up clangd on Windows and I've read a lot of issues, the clangd documentation itself and even the source code to try and figure out what is happening. This doesn't happen on Linux, it works flawlessly everytime there.
I'm using the arm-none-eabi toolchain, together with CMake and Ninja.
CMake is generating the following paths, found in compile_commands.json.
The command key has a value with the path of the compiler, using \\.
My clangd is set up as:
That seems about right... I'm using two backwards slashes in compile_commands.json (which is generated for me), and I literally copied the path and placed it in the query-driver adding a glob at the end. However, it doesn't work:
As you can see, it says the driver is not allowed and then prints the driver using only one backward slash... and that's my guess as to why it isn't working.
Line 299 at SystemIncludeExtractor.cpp is where things go wrong.
Can I get some help on this? I don't know if it's a mistake or it's a bug. The thing is that in the end of the day I can't get it to work on Windows.
edit: Note that the letter C from C:\ is capitalized in some paths, while not capitalized in others... Don't know if that could be the source of the problem too.
edit2: Can confirm that by changing the \\ slashes in compile_commands.json to / and setting the query-driver to use / as well, it works, but that makes the configuration manual.
The text was updated successfully, but these errors were encountered: