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

    <tr>
        <th>Summary</th>
        <td>
            clangd --query-driver doesn't seem to work with double slashes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    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.

```
{
 "directory": "C:/Desenvolvimento",
  "command": "C:\\Programas\\arm-gnu-toolchain\\bin\\arm-none-eabi-gcc.exe <...>,
  "file": <...>,
  "output": <...>
},
```

The command key has a value with the path of the compiler, using \\\\.

My clangd is set up as:
```
I[22:52:39.070] clangd version 16.0.0
I[22:52:39.071] Features: windows
I[22:52:39.071] PID: 920
I[22:52:39.071] Working directory: c:\Desenvolvimento
I[22:52:39.071] argv[0]: C:\Programas\LLVM\bin\clangd.EXE
I[22:52:39.071] argv[1]: --log=verbose
I[22:52:39.071] argv[2]: --query-driver="C:\\Programas\\arm-gnu-toolchain\\bin\\arm-none-eabi-g*"
```

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:

```
I[22:52:39.257] <-- textDocument/didOpen
V[22:52:39.257] System include extraction: driver clang expanded to C:\Programas\LLVM\bin\clang.exe
V[22:52:39.257] System include extraction: not allowed driver C:\Programas\LLVM\bin\clang.exe
V[22:52:39.261] <<< {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}

I[22:52:39.261] <-- $/setTrace
I[22:52:39.261] unhandled notification $/setTrace
I[22:52:39.261] Loaded compilation database from c:\Desenvolvimento\build/compile_commands.json
V[22:52:39.261] Broadcasting compilation database from c:\Desenvolvimento
V[22:52:39.262] System include extraction: not allowed driver C:\Programas\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe
```

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](https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/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. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysV19v47gR_zT0y8CCTMV2_OCHxF73UmTbQ7u461sxEscSNxSpkpQdf_tiRDmJc0kui1tAsCWK8_83P44wBF1borWY34r5doJ9bJxf_90F-luvTUO-pc2_JqVTp_UvZIyD2JAnIWci34r8Jv3eCbk8ENQuQnAtgQ6hpwDOQqAYta2h76AyaGvFi79rq9wxAFoFo6gnVIBgXAS3H-WF3LC1s6ByVd-SjRi1s6BjILMfVNCB7LAxuN5XBJVTBNFB9Kfh_V7XvSdwfYRjgxF0gAa7jqy2dQbfGh1AOQpWyGUc37CX99r2j-yDjnB0_iHA3uDRUAjmxDb9KeqWUj6y19looQ8cN7uFvp1aZ2lKWGqIzpmqQW2H8FxNrACOOjaw-YoPNLj8D22_YwZJX1rWAWqy5DGe9e6dMe7ITx3GZkjX3vVWgbZQubbThv5bubZFq0L2PTh74aVY5OOVHpe36QaElEp7qqLzJyGlKIaljShuhNxtKZA9OHPQXArH7-VmFORto71XcvONmG9-9a722GJIj5yV2vbT53wMy-X55iJr07qqMnokEMUmyzJRfLk0u9eGzjbf3uH62PXxD3vG2LdPm1-nZfj9xihMkcEDnaDBAAgHND2lynE5uAgM3pg2c_o91yQBIQWVros6fD2dAa4Dtwu3CgbO2lv-3In57RDDnH-KVZYvczHfnlUcyAfujtkiy7P3RWYssiOMvSc2BcfUkR8L_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