clangd
clangd copied to clipboard
clangd Hangs after running `assert([{,}])`
clangd seems to hang for no apparent reason from an assert call.
I tried multiple versions of clangd, but all of them seemed to hang. This could be a clangd problem, but I couldn't reproduce the error in another text editor.
Clangd version (from the log, or clangd --version): 17.0.6
clangd extension version: v0.1.26
Operating system: Mac
I can reproduce this. The hang is in SelectionVisitor::claimRange(), invoked during textDocument/codeAction.
An assertions-enabled build crashes with:
clang-tools-extra/clangd/Selection.cpp:330: SelectionTree::Selection clang::clangd::(anonymous namespace)::SelectionTester::test(llvm::ArrayRefsyntax::Token) const: Assertion `!Batch.empty()' failed
Based on the previous comments, this is definitely a server-side issue.
Not happening with other editors is probably related to other editors not sending textDocument/codeAction as aggressively (i.e. without explicit invocation).
Looks like the same issue as https://github.com/llvm/llvm-project/issues/58482. There's some analysis in that issue, I'll close this one as a dupe.
Duplicate of https://github.com/llvm/llvm-project/issues/58482