llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.53k forks source link

[clangd] assertion failure in include cleaner #99617

Closed yshui closed 2 weeks ago

yshui commented 1 month ago

To reproduce:

  1. clone yshui/deai, branch clangd-bug
  2. generate compile_commands.json
  3. clangd -check=include/deai/c++/c_api.hh
yshui commented 1 month ago

My attempt at fixing #99514

yshui commented 1 month ago

Wait, I realized the version of deai currently on github doesn't have this problem. Let me fix that.


Edit: I think I just forgot to push my .clang-tidy. should be reproducible now.

llvmbot commented 1 month ago

@llvm/issue-subscribers-clangd

Author: Yuxuan Shui (yshui)

To reproduce: 1. clone [yshui/deai](https://github.com/yshui/deai) 2. generate compile_commands.json 3. `clangd -check=include/deai/c++/c_api.hh`
HighCommander4 commented 3 weeks ago
  1. generate compile_commands.json

Could you give some more details on how you generate compile_commands.json for this project?

HighCommander4 commented 3 weeks ago

I figured it out: meson setup -Dplugins=[] build generates build/compile_commands.json.

However, I do not get a crash at step 3. Could you attach the output of clangd -check=include/deai/c++/c_api.hh please?

yshui commented 3 weeks ago

hmm, i can't reproduce it now either... i wish i had at least saved a stack trace :/

i'll try to see if i can make it happen again.

yshui commented 3 weeks ago

ah! i see.

meson setup -Dplugins=[] build

this has to have -Dbuildtype=release. yeah this bug only happens if optimization is enabled.

yshui commented 3 weeks ago

(this one doesn't have symbols)

I[09:41:21.339] clangd version 18.1.8
I[09:41:21.340] Features: linux
I[09:41:21.340] PID: 1152528
I[09:41:21.340] Working directory: /tmp/deai
I[09:41:21.340] argv[0]: /nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd
I[09:41:21.340] argv[1]: -check=include/deai/c++/c_api.hh
I[09:41:21.340] Entering check mode (no LSP server)
I[09:41:21.340] Testing on source file /tmp/deai/include/deai/c++/c_api.hh
I[09:41:21.340] Loading compilation database...
I[09:41:21.340] Loaded compilation database from /tmp/deai/compile_commands.json
I[09:41:21.340] Compile command inferred from ../bindings/c++/builtins.cc is: [/tmp/deai/build] /nix/store/1rxqqb3m7k2c36kvsm0alqljbb01x138-clang-wrapper-18.1.8/bin/g++ --driver-mode=g++ -Ibindings/c++/libcpp_binding.a.p -Ibindings/c++ -I../bindings/c++ -Iinclude -I../include -I. -I.. -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -fPIC -MD -MQ bindings/c++/libcpp_binding.a.p/builtins.cc.o -MF bindings/c++/libcpp_binding.a.p/builtins.cc.o.d -c -std=c++20 -ferror-limit=0 -resource-dir=/nix/store/dplaf5lkshdrp0n0lxlglgn1mwz9vqv1-clang-18.1.8/lib/clang/18 -- /tmp/deai/include/deai/c++/c_api.hh
I[09:41:21.340] Loaded compilation database from /tmp/deai/build/compile_commands.json
I[09:41:21.340] Giving up on broadcasting CDB, as we're shutting down
I[09:41:21.340] Parsing command...
I[09:41:21.341] internal (cc1) args are: -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name c_api.hh -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/tmp/deai/build -fcoverage-compilation-dir=/tmp/deai/build -nostdsysteminc -resource-dir /nix/store/dplaf5lkshdrp0n0lxlglgn1mwz9vqv1-clang-18.1.8/lib/clang/18 -dependency-file bindings/c++/libcpp_binding.a.p/builtins.cc.o.d -MT bindings/c++/libcpp_binding.a.p/builtins.cc.o -sys-header-deps -module-file-deps -I bindings/c++/libcpp_binding.a.p -I bindings/c++ -I ../bindings/c++ -I include -I ../include -I . -I .. -D _GLIBCXX_ASSERTIONS=1 -D _FILE_OFFSET_BITS=64 -I/nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -I/nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -I/nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -I/nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -I/nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -I/nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -I/nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -I/nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -I/nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -I/nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -I/nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -I/nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -I/nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -I/nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -I/nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -I/nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -I/nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -I/nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -I/nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -I/nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -I/nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -I/nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -I/nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -I/nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -I/nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -I/nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -I/nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -I/nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -I/nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -I/nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -I/nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -I/nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -I/nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -I/nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -I/nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -I/nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -I/nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -I/nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -I/nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -I/nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -I/nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -I/nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -I/nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -I/nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -I/nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -I/nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -I/nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -I/nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -I/nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -I/nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -I/nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -I/nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -I/nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -I/nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -I/nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -I/nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -I/nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -I/nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -I/nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -I/nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -I/nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -I/nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -I/nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -I/nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -I/nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -I/nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -I/nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -I/nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -I/nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -I/nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -I/nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -I/nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -I/nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -I/nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -I/nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -I/nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -I/nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -I/nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -I/nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -I/nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -I/nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -I/nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -I/nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -I/nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -I/nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -I/nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -I/nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -I/nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -I/nix/store/09lv9r3dx6ql0lzpdv8w2b1r6b358481-glibc-2.39-52-dev/include -I/nix/store/1rxqqb3m7k2c36kvsm0alqljbb01x138-clang-wrapper-18.1.8/resource-root/include -cxx-isystem /nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -cxx-isystem /nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -cxx-isystem /nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -cxx-isystem /nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -cxx-isystem /nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -cxx-isystem /nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -cxx-isystem /nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -cxx-isystem /nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -cxx-isystem /nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -cxx-isystem /nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -cxx-isystem /nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -cxx-isystem /nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -cxx-isystem /nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -cxx-isystem /nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -cxx-isystem /nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -cxx-isystem /nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -cxx-isystem /nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -cxx-isystem /nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -cxx-isystem /nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -cxx-isystem /nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -cxx-isystem /nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -cxx-isystem /nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -cxx-isystem /nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -cxx-isystem /nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -cxx-isystem /nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -cxx-isystem /nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -cxx-isystem /nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -cxx-isystem /nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -cxx-isystem /nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -cxx-isystem /nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -cxx-isystem /nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -cxx-isystem /nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -cxx-isystem /nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -cxx-isystem /nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -cxx-isystem /nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -cxx-isystem /nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -cxx-isystem /nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -cxx-isystem /nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -cxx-isystem /nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -cxx-isystem /nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -cxx-isystem /nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -cxx-isystem /nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -cxx-isystem /nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -cxx-isystem /nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -cxx-isystem /nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -cxx-isystem /nix/store/w5ki521kwf0nqilgcl1nzh2b3icw7b6y-python3-3.12.4-env/include -cxx-isystem /nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -cxx-isystem /nix/store/d64zq8qkisz0rwlzz51n5cy6nif8c40i-xdotool-3.20211022.1/include -cxx-isystem /nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -cxx-isystem /nix/store/q7pkpbcp1siah46qxxgkz3kmgq3wjy1p-lua-5.2.4/include -cxx-isystem /nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -cxx-isystem /nix/store/4vkj3qipw2rkfrjj3s79w2w8jraf1lyp-compiler-rt-libc-18.1.8-dev/include -cxx-isystem /nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -cxx-isystem /nix/store/fribqv663wm7rcg474jxryp3k949h14v-libev-4.33/include -cxx-isystem /nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -cxx-isystem /nix/store/y82b3izg01g56rh3q3rqcrg54hgkk8hi-libffi-3.4.6-dev/include -cxx-isystem /nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -cxx-isystem /nix/store/5wdnlp7dwp5hhgjnhpbijyd309d9qkn9-libxcb-1.17.0-dev/include -cxx-isystem /nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -cxx-isystem /nix/store/523gqyxmz4kapi2v43clqjzasy2lh2cr-libXau-1.0.11-dev/include -cxx-isystem /nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -cxx-isystem /nix/store/rylqbcy1y8acjkmxaasbmm49bp31ndib-xorgproto-2024.1/include -cxx-isystem /nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -cxx-isystem /nix/store/wx9cw12ax4jdhndc5ncrfd3999kkrznr-libXdmcp-1.1.5-dev/include -cxx-isystem /nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -cxx-isystem /nix/store/y6zc3g5inxa1jgqd2rkp402li92i4wv0-xcb-util-keysyms-0.4.1-dev/include -cxx-isystem /nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -cxx-isystem /nix/store/spb8bqkgqxpn0hf4nblwfwdfgx9k4npg-libxkbcommon-1.7.0-dev/include -cxx-isystem /nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -cxx-isystem /nix/store/nlpgf5lcqkdwb1apkr6k1hf5wzhb4n42-dbus-1.14.10-dev/include -cxx-isystem /nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -cxx-isystem /nix/store/6a5kk6acn7xrccicip3f3rackgk8chps-expat-2.6.2-dev/include -cxx-isystem /nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -cxx-isystem /nix/store/x3zb6ixhjlgpvghpb5lh0gr3sb4zb1kn-systemd-minimal-libs-255.6-dev/include -cxx-isystem /nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -cxx-isystem /nix/store/nqc616043cqcffxi97zvd0nddqvb4w6a-lua-5.2.4/include -cxx-isystem /nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -cxx-isystem /nix/store/ls9aif8qg9l0mcsg5h21dvg91hhr8sf7-libdisplay-info-0.2.0/include -cxx-isystem /nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -cxx-isystem /nix/store/v66lkdj6kldq717abxblgh5wr969s99b-libunwind-1.8.1-dev/include -cxx-isystem /nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -cxx-isystem /nix/store/0dj2pdgkcsjg10m42pcfxv8xnl16ay6y-xz-5.6.2-dev/include -cxx-isystem /nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -cxx-isystem /nix/store/ippzvikxgn3pkjf4qbi2ih0x8j51xb58-elfutils-0.191-dev/include -cxx-isystem /nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -cxx-isystem /nix/store/c8j6z63459gy7s7fjjvdj918hw0nki39-zlib-1.3.1-dev/include -cxx-isystem /nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -cxx-isystem /nix/store/v56i3cdv3zr6zljygs90gwywirhbl37n-zstd-1.5.6-dev/include -cxx-isystem /nix/store/3s3rjkl3mx05wp0lmxgwkaqhbz9sy6kk-gcc-13.3.0/include/c++/13.3.0 -cxx-isystem /nix/store/3s3rjkl3mx05wp0lmxgwkaqhbz9sy6kk-gcc-13.3.0/include/c++/13.3.0/x86_64-unknown-linux-gnu -cxx-isystem /nix/store/09lv9r3dx6ql0lzpdv8w2b1r6b358481-glibc-2.39-52-dev/include -cxx-isystem /nix/store/1rxqqb3m7k2c36kvsm0alqljbb01x138-clang-wrapper-18.1.8/resource-root/include -internal-isystem /nix/store/dplaf5lkshdrp0n0lxlglgn1mwz9vqv1-clang-18.1.8/lib/clang/18/include -source-date-epoch 315532800 -O3 -Wall -Winvalid-pch -std=c++20 -fdeprecated-macro -ferror-limit 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++-header /tmp/deai/include/deai/c++/c_api.hh
I[09:41:21.342] Building preamble...
I[09:41:21.355] Built preamble of size 448780 for file /tmp/deai/include/deai/c++/c_api.hh version null in 0.01 seconds
I[09:41:21.355] Indexing headers...
I[09:41:21.362] Building AST...
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd -check=include/deai/c++/c_api.hh
 #0 0x00007fffec0dd2de llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xedd2de)
 #1 0x00007fffec0da72b SignalHandler(int) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xeda72b)
 #2 0x00007fffeac495c0 __restore_rt (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x405c0)
 #3 0x00007ffff6c40a19 clang::syntax::TokenBuffer::spelledTokenAt(clang::SourceLocation) const (/nix/store/wsqahmc3a5a2pwmc40r6mmwq8xw59s3q-clang-18.1.8-lib/lib/libclang-cpp.so.18.1+0x2e40a19)
 #4 0x000000000087ea80 (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x87ea80)
 #5 0x0000000000883722 (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x883722)
 #6 0x00000000008f0735 (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x8f0735)
 #7 0x00000000006ddf69 (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x6ddf69)
 #8 0x00000000006e006a (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x6e006a)
 #9 0x00000000006d29ba (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x6d29ba)
#10 0x00007fffeac3314e __libc_start_call_main (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x2a14e)
#11 0x00007fffeac33209 __libc_start_main@GLIBC_2.2.5 (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x2a209)
#12 0x0000000000638ca5 (/nix/store/h9rfb7qrk06b9q16b36ibf6g42wybwjr-clang-tools-18.1.8/bin/clangd+0x638ca5)
fish: Job 1, 'clangd -check=include/deai/c++/…' terminated by signal SIGSEGV (Address boundary error)
HighCommander4 commented 3 weeks ago

meson setup -Dplugins=[] build

this has to have -Dbuildtype=release. yeah this bug only happens if optimization is enabled.

Thanks, I can reproduce the assertion failure with -Dbuildtype=release.

HighCommander4 commented 3 weeks ago

And here is the actual assertion message and more detailed stack trace from a debug build:

I[00:22:13.977] Building AST...
clang/lib/Tooling/Syntax/Tokens.cpp:382: llvm::ArrayRef<syntax::Token> clang::syntax::TokenBuffer::spelledTokens(FileID) const: Assertion `It != Files.end()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clangd-dev --check=include/deai/c++/c_api.hh
 #0 0x00007f5245e01a3d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x00007f5245e01f2b PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00007f5245dfffb6 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:105:5
 #3 0x00007f5245e026b5 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f524c48c140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13140)
 #5 0x00007f5245546ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007f5245530537 abort ./stdlib/abort.c:81:7
 #7 0x00007f524553040f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #8 0x00007f524553040f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #9 0x00007f524553f662 (/lib/x86_64-linux-gnu/libc.so.6+0x31662)
#10 0x00007f524afbb587 clang::syntax::TokenBuffer::spelledTokens(clang::FileID) const clang/lib/Tooling/Syntax/Tokens.cpp:0:3
#11 0x00007f524afbb626 clang::syntax::TokenBuffer::spelledTokenContaining(clang::SourceLocation) const clang/lib/Tooling/Syntax/Tokens.cpp:390:7
#12 0x00007f524bc33760 clang::clangd::collectMacroReferences(clang::clangd::ParsedAST&) clang-tools-extra/clangd/IncludeCleaner.cpp:306:19
#13 0x00007f524bc33d8b clang::clangd::computeIncludeCleanerFindings(clang::clangd::ParsedAST&, bool) clang-tools-extra/clangd/IncludeCleaner.cpp:370:39
#14 0x00007f524bd2748b clang::clangd::(anonymous namespace)::getIncludeCleanerDiags(clang::clangd::ParsedAST&, llvm::StringRef, clang::clangd::ThreadsafeFS const&) clang-tools-extra/clangd/ParsedAST.cpp:378:7
#15 0x00007f524bd264a1 clang::clangd::ParsedAST::build(llvm::StringRef, clang::clangd::ParseInputs const&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, llvm::ArrayRef<clang::clangd::Diag>, std::shared_ptr<clang::clangd::PreambleData const>) clang-tools-extra/clangd/ParsedAST.cpp:747:40
#16 0x00007f524c443e1a clang::clangd::(anonymous namespace)::Checker::buildAST() clang-tools-extra/clangd/tool/Check.cpp:254:11
#17 0x00007f524c442fd1 clang::clangd::check(llvm::StringRef, clang::clangd::ThreadsafeFS const&, clang::clangd::ClangdLSPServer::Options const&) clang-tools-extra/clangd/tool/Check.cpp:514:7
#18 0x00007f524c4013d2 clang::clangd::clangdMain(int, char**) clang-tools-extra/clangd/tool/ClangdMain.cpp:976:12
yshui commented 3 weeks ago

@HighCommander4 and my analysis in #99514 . basically the source location is calculated relative to one file, then later combined with a different file.

HighCommander4 commented 3 weeks ago

I've tried to reduce the code that triggers the assertion failure to something minimal, but it's proving difficult.

yshui commented 3 weeks ago

@HighCommander4 the size of the file matters. if the bug disappears sometimes you should try fill the file with garbage e.g. comments.

HighCommander4 commented 2 weeks ago

I started debugging a partially reduced testcase, and I discovered something quite interesting.

I added an assertion in CollectMainFileMacros::add(), checking that the added location was indeed in the main file. When that assertion failed, I looked at the stack trace, and found that it was the modernize-use-trailing-return-type clang-tidy checker calling into the preprocessor here.

That call can get into PPCallbacks::MacroExpands(), but unlike the calls to PPCallbacks::MacroExpands() that occur during the usual course of parsing the file, this call is not interleaved with FileChanged() calls the way the clangd implementation of PPCallbacks expects.

The clang-tidy checks are in turn run by clangd here, a bit after the actual parse which happens here.

Clangd cares about its CollectMainFileMacros callbacks running during the parse, but (I'm pretty sure) not during the clang-tidy checks. So, an idea for a solution could be to remove the CollectMainFileMacros callbacks in between the parse and the clang-tidy checks.

HighCommander4 commented 2 weeks ago

When that assertion failed, I looked at the stack trace, and found that it was the modernize-use-trailing-return-type clang-tidy checker calling into the preprocessor here.

(By the way, this means that a workaround for the crash is to disable this checker in .clang-tidy (or only for clangd using https://clangd.llvm.org/config.html#remove-1)).

HighCommander4 commented 2 weeks ago

Here is a minimal test case which triggers this new assertion:

$ git diff
diff --git a/clang-tools-extra/clangd/CollectMacros.cpp b/clang-tools-extra/clangd/CollectMacros.cpp
index c5ba8d903ba4..96298ee3ea50 100644
--- a/clang-tools-extra/clangd/CollectMacros.cpp
+++ b/clang-tools-extra/clangd/CollectMacros.cpp
@@ -32,6 +32,7 @@ void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,
   if (Loc.isInvalid() || Loc.isMacroID())
     return;

+  assert(isInsideMainFile(Loc, SM));
   auto Name = MacroNameTok.getIdentifierInfo()->getName();
   Out.Names.insert(Name);
   size_t Start = SM.getFileOffset(Loc);

.clang-tidy:

Checks: modernize-use-trailing-return-type

a.cpp:

extern "C" {
#include "b.h"
}

b.h:

#define EXTERN extern
EXTERN int waldo();
I[19:43:02.390] clangd version 19.0.0git
I[19:43:02.390] Features: linux+debug
I[19:43:02.390] PID: 2297451
I[19:43:02.390] Working directory: /workspace
I[19:43:02.390] argv[0]: clangd-dev
I[19:43:02.390] argv[1]: --check=a.cpp
I[19:43:02.391] Entering check mode (no LSP server)
I[19:43:02.391] Testing on source file /workspace/a.cpp
I[19:43:02.391] Loading compilation database...
I[19:43:02.392] Failed to find compilation database for /workspace/a.cpp
I[19:43:02.394] Generic fallback command is: [/workspace] /usr/lib/llvm-16/bin/clang -xobjective-c++-header -resource-dir=/clang-19 -- /workspace/a.cpp
I[19:43:02.394] Parsing command...
I[19:43:02.400] internal (cc1) args are: -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -main-file-name a.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/workspace -fcoverage-compilation-dir=/workspace -resource-dir /clang-19 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /clang-19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fobjc-runtime=gcc -fobjc-encode-cxx-class-template-spec -fobjc-exceptions -fcxx-exceptions -fexceptions -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x objective-c++-header /workspace/a.cpp
I[19:43:02.400] Building preamble...
I[19:43:02.431] Built preamble of size 226608 for file /workspace/a.cpp version null in 0.03 seconds
I[19:43:02.431] Indexing headers...
I[19:43:02.433] Building AST...
clangd-dev: clang-tools-extra/clangd/CollectMacros.cpp:35: void clang::clangd::CollectMainFileMacros::add(const Token &, const MacroInfo *, bool, bool): Assertion `isInsideMainFile(Loc, SM)' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clangd-dev --check=a.cpp
1.      ASTMatcher: Processing 'modernize-use-trailing-return-type' against:
        FunctionDecl waldo : </workspace/b.h:2:1 <Spelling=line:1:16>, line:2:18>
--- Bound Nodes Begin ---
    Func - { FunctionDecl waldo : </workspace/b.h:2:1 <Spelling=line:1:16>, line:2:18> }
--- Bound Nodes End ---
 #0 0x00007fb09b803a3d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x00007fb09b803f2b PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00007fb09b801fb6 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:105:5
 #3 0x00007fb09b8046b5 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007fb0a1e8e140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13140)
 #5 0x00007fb09af48ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007fb09af32537 abort ./stdlib/abort.c:81:7
 #7 0x00007fb09af3240f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #8 0x00007fb09af3240f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #9 0x00007fb09af41662 (/lib/x86_64-linux-gnu/libc.so.6+0x31662)
#10 0x00007fb0a13e4791 clang::clangd::CollectMainFileMacros::add(clang::Token const&, clang::MacroInfo const*, bool, bool) clang-tools-extra/clangd/CollectMacros.cpp:36:15
#11 0x00007fb0a13e49cb clang::clangd::CollectMainFileMacros::MacroExpands(clang::Token const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs const*) clang-tools-extra/clangd/CollectMacros.cpp:56:1
#12 0x00007fb09c64fdd1 clang::PPChainedCallbacks::MacroExpands(clang::Token const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs const*) clang/include/clang/Lex/PPCallbacks.h:616:12
#13 0x00007fb09c64fe02 clang::PPChainedCallbacks::MacroExpands(clang::Token const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs const*) clang/include/clang/Lex/PPCallbacks.h:618:3
#14 0x00007fb09c64fe02 clang::PPChainedCallbacks::MacroExpands(clang::Token const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs const*) clang/include/clang/Lex/PPCallbacks.h:618:3
#15 0x00007fb09c64fe02 clang::PPChainedCallbacks::MacroExpands(clang::Token const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs const*) clang/include/clang/Lex/PPCallbacks.h:618:3
#16 0x00007fb09c684c73 clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&, clang::MacroDefinition const&) clang/lib/Lex/PPMacroExpansion.cpp:544:18
#17 0x00007fb09c6b8efb clang::Preprocessor::HandleIdentifier(clang::Token&) clang/lib/Lex/Preprocessor.cpp:816:11
#18 0x00007fb09c6d0e24 clang::TokenLexer::Lex(clang::Token&) clang/lib/Lex/TokenLexer.cpp:717:7
#19 0x00007fb09c67bc8c clang::Preprocessor::CLK_TokenLexer(clang::Preprocessor&, clang::Token&) clang/include/clang/Lex/Preprocessor.h:2970:5
#20 0x00007fb09c6b922b clang::Preprocessor::Lex(clang::Token&) clang/lib/Lex/Preprocessor.cpp:873:10
#21 0x00007fb097afef06 clang::tidy::modernize::classifyToken(clang::FunctionDecl const&, clang::Preprocessor&, clang::Token) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:200:11
#22 0x00007fb097afebe6 clang::tidy::modernize::UseTrailingReturnTypeCheck::classifyTokensBeforeFunctionName(clang::FunctionDecl const&, clang::ASTContext const&, clang::SourceManager const&, clang::LangOptions const&) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:254:40
#23 0x00007fb097aff8ac clang::tidy::modernize::UseTrailingReturnTypeCheck::keepSpecifiers(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, clang::SourceRange, clang::FunctionDecl const&, clang::FriendDecl const*, clang::ASTContext const&, clang::SourceManager const&, clang::LangOptions const&) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:350:8
#24 0x00007fb097b007d3 clang::tidy::modernize::UseTrailingReturnTypeCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:492:8
#25 0x00007fb09ab700de clang::tidy::ClangTidyCheck::run(clang::ast_matchers::MatchFinder::MatchResult const&) clang-tools-extra/clang-tidy/ClangTidyCheck.cpp:47:1
#26 0x00007fb095652c18 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::MatchVisitor::visitMatch(clang::ast_matchers::BoundNodes const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1271:7
#27 0x00007fb0957a12cc clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) clang/lib/ASTMatchers/ASTMatchersInternal.cpp:105:5
#28 0x00007fb095652735 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1067:7
#29 0x00007fb095652402 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchDispatch(clang::Decl const*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1086:5
#30 0x00007fb09565220d void clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::match<clang::Decl>(clang::Decl const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:731:3
#31 0x00007fb0956552ad clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1470:3
#32 0x00007fb0956be208 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) clang/include/clang/AST/RecursiveASTVisitor.h:1535:7
#33 0x00007fb095656b25 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseLinkageSpecDecl(clang::LinkageSpecDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1623:1
#34 0x00007fb095655490 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:42:1
#35 0x00007fb0956552ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3
#36 0x00007fb095656479 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1635:1
#37 0x00007fb09565540f clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:24:1
#38 0x00007fb0956552ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3
#39 0x00007fb0955c71e2 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseAST(clang::ASTContext&) clang/include/clang/AST/RecursiveASTVisitor.h:190:5
#40 0x00007fb0955c703c clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1700:11
#41 0x00007fb0a17281e2 clang::clangd::ParsedAST::build(llvm::StringRef, clang::clangd::ParseInputs const&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, llvm::ArrayRef<clang::clangd::Diag>, std::shared_ptr<clang::clangd::PreambleData const>) clang-tools-extra/clangd/ParsedAST.cpp:719:3
#42 0x00007fb0a1e45e1a clang::clangd::(anonymous namespace)::Checker::buildAST() clang-tools-extra/clangd/tool/Check.cpp:254:11
#43 0x00007fb0a1e44fd1 clang::clangd::check(llvm::StringRef, clang::clangd::ThreadsafeFS const&, clang::clangd::ClangdLSPServer::Options const&) clang-tools-extra/clangd/tool/Check.cpp:514:7
#44 0x00007fb0a1e033d2 clang::clangd::clangdMain(int, char**) clang-tools-extra/clangd/tool/ClangdMain.cpp:976:12
#45 0x000055fb0888e2f2 main clang-tools-extra/clangd/tool/ClangdToolMain.cpp:12:3
#46 0x00007fb09af33d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#47 0x000055fb0850794a _start (build/bin/clangd+0x17994a)
Aborted
HighCommander4 commented 2 weeks ago

Proposed fix: https://github.com/llvm/llvm-project/pull/106329