yuzhan wang
yuzhan wang

Reputation: 1

Clangd-VSCode server crashes when processing std::ranges::count_if

Description

Clangd crashes consistently in VSCode when trying to parse a file containing the following line of code:

return (wide ? wide_ulen(str) : std::ranges::count_if(str, [](char c) { return (static_cast<unsigned char>(c) & 0xC0) != 0x80; }));

This line is intended to count characters in a UTF-8 string, excluding continuation bytes. The crash occurs irrespective of the file's other contents.

If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).

return (wide ? wide_ulen(str) : std::ranges::count_if(str, [](char c) { return (static_cast<unsigned char>(c) & 0xC0) != 0x80; }));

Logs Please attach the clangd log from the "Output" window if you can. If possible, run with --log=verbose - note that the logs will include the contents of open files!

I[15:44:33.191] <-- textDocument/documentSymbol(4)
I[15:44:33.827] --> textDocument/publishDiagnostics
[Error - 15:44:35] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentLink failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]

System information Clangd version (from the log, or clangd --version): clangd version 10.0.0-4ubuntu1 clangd extension version: v0.1.28 Operating system: Ubuntu Linux 20.04

return (wide ? wide_ulen(str) : std::ranges::count_if(str, [](char c) { return (static_cast<unsigned char>(c) & 0xC0) != 0x80; }));

VSCode report:

  1. vscode source:clangd : Connection to server got closed. Server will not be restarted.
  2. Client Clang Language Server: connection to server is erroring. Shutting down server.

Logs Please attach the clangd log from the "Output" window if you can. If possible, run with --log=verbose - note that the logs will include the contents of open files!

I[15:44:33.191] <-- textDocument/documentSymbol(4)
I[15:44:33.827] --> textDocument/publishDiagnostics
[Error - 15:44:35] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentLink failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]

Upvotes: 0

Views: 356

Answers (0)

Related Questions