2

我有一个 C++ 项目,我可以在其中打开任何 .cpp 或 .h,并且 LSP 将崩溃/失败(我使用带有 .cpp 的 emacs lsp-mode)。

例如,如果我尝试打开一个名为 的文件,clangd 将失败,并在clangd::stderr缓冲区IDictionary.h中出现以下错误

I[17:33:37.200] BeginSourceFile() failed when building AST for /home/anlsh/work/horizon-runtime/src/prod/data/IDictionary.h
I[17:33:37.246] <-- textDocument/documentHighlight(103)
I[17:33:37.246] --> reply:textDocument/documentHighlight(103) 0 ms, error: invalid AST

ccls 也失败(带信号退出),尽管它的错误消息也没有帮助

17:36:44 indexer6          indexer.cc:1302 E failed to index /home/anlsh/work/horizon-runtime/src/prod/data/IDictionary.h
/snap/ccls/48/bin/../usr/lib/x86_64-linux-gnu/libLLVM-7.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x2a)[0x7f2301010e8a]
/snap/ccls/48/bin/../usr/lib/x86_64-linux-gnu/libLLVM-7.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x7f230100f544]
/snap/ccls/48/bin/../usr/lib/x86_64-linux-gnu/libLLVM-7.so.1(+0x907682)[0x7f230100f682]
/snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7f22fff5a8a0]
/snap/ccls/48/bin/ccls(+0x24ae87)[0x5564df56ee87]
/snap/core18/current/lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f22fff4f6db]
/snap/core18/current/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f22ffc78a3f]

无论如何,这发生在项目中的每个文件中,即使是简单的

#include "stdafx.h"
using namespace Api;

我的假设是 build/compile_commands.json 拉入的一些文件正在搞砸一切,但我不能确定。VSCode(我假设它使用的是 LSP,虽然我知道它有自己的技巧)在我的项目中根本没有任何问题。

无论如何,我希望有人可以向我指出一些更详细的日志clangdccls日志,也许还有一些命令可以让我获得更多信息性错误消息或验证项目中的文件

4

1 回答 1

2

该问题似乎已在最新版本的 clangd (11.0) 和 ccls (0.20190823.6-26-g141aea8a) 上得到修复

Sam McCall 在 LLVM discord 上也有这样的说法

您可以通过将 -log=verbose 添加到 clangd args 并提供更多日志来获得更多信息(可能相关的内容包括版本、路径、序言构建......)。我对 windows stdafx 了解不多,但我知道它包含了很多东西,其中一些可能已经解决了该版本中的错误。

于 2020-09-14T05:42:57.623 回答