gpt4 book ai didi

c++ - 调试 C++ 语言服务器错误 : Invalid AST

转载 作者:行者123 更新时间:2023-12-03 07:01:00 29 4
gpt4 key购买 nike

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

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

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 日志,也许还有一些命令可以让我获得更多信息性错误消息或验证我项目中的文件

最佳答案

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

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

You can get a bit more info by adding -log=verbose to the clangd args, and providing more of the log (things that might be relevant include version, path, preamble build, ...).I don't know much about windows stdafx, but I understand it pulls in a lot of stuff, some of which may have tickled a bug in that version.

关于c++ - 调试 C++ 语言服务器错误 : Invalid AST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63875991/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com