In logs, there are lines like Indexing c++14 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h, and I[16:20:46.125] Indexing c++23 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp. I guess the difference is the reason.
However when use c++20, "/std:c++20" in compile_commands.json, it comes back to normal.
It's ok!
Additionally, I[17:43:24.673] Indexing c++20 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h is in logs.
Reproduce code
// in file header.h
namespace A:B{
void funcA();
}
// in file source.cpp
namespace A:B{
void funcA(){
// do something
return;
}
}
Logs
I[16:20:45.311] clangd version 18.1.4
I[16:20:45.312] Features: windows
I[16:20:45.312] PID: 4412
I[16:20:45.312] Working directory: d:\projects\program\cpp\nozzle-design
I[16:20:45.312] argv[0]: D:\Apps\sdk\LLVM\bin\clangd.exe
I[16:20:45.312] argv[1]: --compile-commands-dir=d:\projects\program\cpp\nozzle-design/build
I[16:20:45.312] argv[2]: --pretty
I[16:20:45.312] argv[3]: --background-index
I[16:20:45.312] argv[4]: --completion-style=detailed
I[16:20:45.312] argv[5]: --completion-parse=auto
I[16:20:45.312] argv[6]: --fallback-style=Google
I[16:20:45.312] argv[7]: --clang-tidy
I[16:20:45.312] argv[8]: --clang-tidy-checks=performance-, bugprone-, misc-, google-, modernize-, readability-, portability-*
I[16:20:45.312] argv[9]: --pch-storage=memory
I[16:20:45.312] argv[10]: --ranking-model=decision_forest
I[16:20:45.312] argv[11]: --header-insertion=never
I[16:20:45.312] argv[12]: --enable-config
I[16:20:45.312] argv[13]: -j=10
I[16:20:45.316] Starting LSP over stdin/stdout
I[16:20:45.316] <-- initialize(0)
I[16:20:45.318] --> reply:initialize(0) 1 ms
I[16:20:45.318] <-- initialized
I[16:20:45.321] <-- textDocument/didOpen
I[16:20:45.321] <-- textDocument/didOpen
I[16:20:45.323] --> textDocument/publishDiagnostics
I[16:20:45.323] Loaded compilation database from d:\projects\program\cpp\nozzle-design/build\compile_commands.json
I[16:20:45.324] ASTWorker building file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp version 482 with command
[d:\projects\program\cpp\nozzle-design]
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe" --driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\windows\x64\releasedbg\libhku.pdb" /W3 /O2 /fp:fast /std:c++latest "/Ilibhku\src" /EHsc /utf-8 "/ID:\apps\sdk\vcpkg\installed\x64-windows-static\include" /GL /DNDEBUG "/Fobuild\.objs\libhku\windows\x64\releasedbg\libhku\src\error\crashhandler.cpp.obj" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" -imsvc "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" "-resource-dir=D:\apps\sdk\LLVM\lib\clang\18" -- "d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp"
I[16:20:45.324] ASTWorker building file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h version 262 with command inferred from libhku\src\error\crashhandler.cpp
[d:\projects\program\cpp\nozzle-design]
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe" --driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\windows\x64\releasedbg\libhku.pdb" /W3 /O2 /fp:fast "/Ilibhku\src" /EHsc /utf-8 "/ID:\apps\sdk\vcpkg\installed\x64-windows-static\include" /GL /DNDEBUG -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" -imsvc "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" /TP "-resource-dir=D:\apps\sdk\LLVM\lib\clang\18" -- "d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h"
I[16:20:45.330] --> window/workDoneProgress/create(0)
I[16:20:45.330] Enqueueing 27 commands for indexing
I[16:20:45.331] <-- reply(0)
I[16:20:45.331] --> $/progress
I[16:20:45.331] --> $/progress
I[16:20:45.331] --> textDocument/clangd.fileStatus
I[16:20:45.331] --> textDocument/clangd.fileStatus
I[16:20:45.333] --> textDocument/publishDiagnostics
I[16:20:45.335] <-- textDocument/documentSymbol(1)
I[16:20:45.336] <-- textDocument/codeAction(2)
I[16:20:45.339] Built preamble of size 236408 for file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h version 262 in 0.01 seconds
I[16:20:45.340] --> workspace/semanticTokens/refresh(1)
I[16:20:45.340] Indexing c++14 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h
I[16:20:45.340] <-- reply(1)
I[16:20:45.349] <-- textDocument/documentLink(3)
I[16:20:45.349] <-- textDocument/inlayHint(4)
I[16:20:45.369] --> textDocument/publishDiagnostics
I[16:20:45.369] --> textDocument/inactiveRegions
I[16:20:45.369] --> reply:textDocument/documentSymbol(1) 34 ms
I[16:20:45.369] --> reply:textDocument/codeAction(2) 33 ms
I[16:20:45.370] --> reply:textDocument/documentLink(3) 20 ms
I[16:20:45.370] --> reply:textDocument/inlayHint(4) 20 ms
I[16:20:45.370] --> textDocument/clangd.fileStatus
I[16:20:45.379] <-- textDocument/semanticTokens/full(5)
I[16:20:45.379] --> reply:textDocument/semanticTokens/full(5) 0 ms
I[16:20:45.379] --> textDocument/clangd.fileStatus
I[16:20:45.640] <-- textDocument/documentSymbol(6)
I[16:20:45.640] --> reply:textDocument/documentSymbol(6) 0 ms
I[16:20:45.641] --> textDocument/clangd.fileStatus
I[16:20:45.641] <-- textDocument/foldingRange(7)
I[16:20:45.641] --> reply:textDocument/foldingRange(7) 0 ms
I[16:20:45.686] <-- textDocument/codeAction(8)
I[16:20:45.686] --> reply:textDocument/codeAction(8) 0 ms
I[16:20:45.686] --> textDocument/clangd.fileStatus
I[16:20:45.912] --> $/progress
I[16:20:45.912] --> $/progress
I[16:20:46.125] Built preamble of size 12471612 for file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp version 482 in 0.79 seconds
I[16:20:46.125] --> workspace/semanticTokens/refresh(2)
I[16:20:46.125] Indexing c++23 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp
I[16:20:46.126] <-- reply(2)
I[16:20:46.126] <-- textDocument/semanticTokens/full/delta(9)
I[16:20:46.127] --> reply:textDocument/semanticTokens/full/delta(9) 0 ms
I[16:20:46.127] --> textDocument/clangd.fileStatus
I[16:20:46.191] --> textDocument/publishDiagnostics
I[16:20:46.191] --> textDocument/inactiveRegions
I[16:20:46.191] --> textDocument/clangd.fileStatus
I[16:20:46.292] Indexed c++14 standard library (incomplete due to errors): 11078 symbols, 2206 filtered
I[16:20:48.708] Indexed c++23 standard library (incomplete due to errors): 14789 symbols, 8728 filtered
System information
Clangd version (from the log, or clangd --version):
clangd extension version: 18.1.4
Operating system: Windows 11 23H2 22631.3447
When I use c++23, "/std:c++latest" in my compile_commands.json,
compile_commands.json: (partial)
the bug appeared, only in the header file.
In logs, there are lines like
Indexing c++14 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h
, andI[16:20:46.125] Indexing c++23 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp
. I guess the difference is the reason.However when use c++20, "/std:c++20" in compile_commands.json, it comes back to normal.
compile_commands.json: (partial)
It's ok!
Additionally,
I[17:43:24.673] Indexing c++20 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h
is in logs.Reproduce code
Logs I[16:20:45.311] clangd version 18.1.4 I[16:20:45.312] Features: windows I[16:20:45.312] PID: 4412 I[16:20:45.312] Working directory: d:\projects\program\cpp\nozzle-design I[16:20:45.312] argv[0]: D:\Apps\sdk\LLVM\bin\clangd.exe I[16:20:45.312] argv[1]: --compile-commands-dir=d:\projects\program\cpp\nozzle-design/build I[16:20:45.312] argv[2]: --pretty I[16:20:45.312] argv[3]: --background-index I[16:20:45.312] argv[4]: --completion-style=detailed I[16:20:45.312] argv[5]: --completion-parse=auto I[16:20:45.312] argv[6]: --fallback-style=Google I[16:20:45.312] argv[7]: --clang-tidy I[16:20:45.312] argv[8]: --clang-tidy-checks=performance-, bugprone-, misc-, google-, modernize-, readability-, portability-* I[16:20:45.312] argv[9]: --pch-storage=memory I[16:20:45.312] argv[10]: --ranking-model=decision_forest I[16:20:45.312] argv[11]: --header-insertion=never I[16:20:45.312] argv[12]: --enable-config I[16:20:45.312] argv[13]: -j=10 I[16:20:45.316] Starting LSP over stdin/stdout I[16:20:45.316] <-- initialize(0) I[16:20:45.318] --> reply:initialize(0) 1 ms I[16:20:45.318] <-- initialized I[16:20:45.321] <-- textDocument/didOpen I[16:20:45.321] <-- textDocument/didOpen I[16:20:45.323] --> textDocument/publishDiagnostics I[16:20:45.323] Loaded compilation database from d:\projects\program\cpp\nozzle-design/build\compile_commands.json I[16:20:45.324] ASTWorker building file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp version 482 with command [d:\projects\program\cpp\nozzle-design] "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe" --driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\windows\x64\releasedbg\libhku.pdb" /W3 /O2 /fp:fast /std:c++latest "/Ilibhku\src" /EHsc /utf-8 "/ID:\apps\sdk\vcpkg\installed\x64-windows-static\include" /GL /DNDEBUG "/Fobuild\.objs\libhku\windows\x64\releasedbg\libhku\src\error\crashhandler.cpp.obj" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" -imsvc "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" "-resource-dir=D:\apps\sdk\LLVM\lib\clang\18" -- "d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp" I[16:20:45.324] ASTWorker building file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h version 262 with command inferred from libhku\src\error\crashhandler.cpp [d:\projects\program\cpp\nozzle-design] "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe" --driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\windows\x64\releasedbg\libhku.pdb" /W3 /O2 /fp:fast "/Ilibhku\src" /EHsc /utf-8 "/ID:\apps\sdk\vcpkg\installed\x64-windows-static\include" /GL /DNDEBUG -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" -imsvc "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" -imsvc "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" /TP "-resource-dir=D:\apps\sdk\LLVM\lib\clang\18" -- "d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h" I[16:20:45.330] --> window/workDoneProgress/create(0) I[16:20:45.330] Enqueueing 27 commands for indexing I[16:20:45.331] <-- reply(0) I[16:20:45.331] --> $/progress I[16:20:45.331] --> $/progress I[16:20:45.331] --> textDocument/clangd.fileStatus I[16:20:45.331] --> textDocument/clangd.fileStatus I[16:20:45.333] --> textDocument/publishDiagnostics I[16:20:45.335] <-- textDocument/documentSymbol(1) I[16:20:45.336] <-- textDocument/codeAction(2) I[16:20:45.339] Built preamble of size 236408 for file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h version 262 in 0.01 seconds I[16:20:45.340] --> workspace/semanticTokens/refresh(1) I[16:20:45.340] Indexing c++14 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.h I[16:20:45.340] <-- reply(1) I[16:20:45.349] <-- textDocument/documentLink(3) I[16:20:45.349] <-- textDocument/inlayHint(4) I[16:20:45.369] --> textDocument/publishDiagnostics I[16:20:45.369] --> textDocument/inactiveRegions I[16:20:45.369] --> reply:textDocument/documentSymbol(1) 34 ms I[16:20:45.369] --> reply:textDocument/codeAction(2) 33 ms I[16:20:45.370] --> reply:textDocument/documentLink(3) 20 ms I[16:20:45.370] --> reply:textDocument/inlayHint(4) 20 ms I[16:20:45.370] --> textDocument/clangd.fileStatus I[16:20:45.379] <-- textDocument/semanticTokens/full(5) I[16:20:45.379] --> reply:textDocument/semanticTokens/full(5) 0 ms I[16:20:45.379] --> textDocument/clangd.fileStatus I[16:20:45.640] <-- textDocument/documentSymbol(6) I[16:20:45.640] --> reply:textDocument/documentSymbol(6) 0 ms I[16:20:45.641] --> textDocument/clangd.fileStatus I[16:20:45.641] <-- textDocument/foldingRange(7) I[16:20:45.641] --> reply:textDocument/foldingRange(7) 0 ms I[16:20:45.686] <-- textDocument/codeAction(8) I[16:20:45.686] --> reply:textDocument/codeAction(8) 0 ms I[16:20:45.686] --> textDocument/clangd.fileStatus I[16:20:45.912] --> $/progress I[16:20:45.912] --> $/progress I[16:20:46.125] Built preamble of size 12471612 for file d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp version 482 in 0.79 seconds I[16:20:46.125] --> workspace/semanticTokens/refresh(2) I[16:20:46.125] Indexing c++23 standard library in the context of d:\projects\program\cpp\nozzle-design\libhku\src\error\crashhandler.cpp I[16:20:46.126] <-- reply(2) I[16:20:46.126] <-- textDocument/semanticTokens/full/delta(9) I[16:20:46.127] --> reply:textDocument/semanticTokens/full/delta(9) 0 ms I[16:20:46.127] --> textDocument/clangd.fileStatus I[16:20:46.191] --> textDocument/publishDiagnostics I[16:20:46.191] --> textDocument/inactiveRegions I[16:20:46.191] --> textDocument/clangd.fileStatus I[16:20:46.292] Indexed c++14 standard library (incomplete due to errors): 11078 symbols, 2206 filtered I[16:20:48.708] Indexed c++23 standard library (incomplete due to errors): 14789 symbols, 8728 filtered
System information Clangd version (from the log, or
clangd --version
): clangd extension version: 18.1.4 Operating system: Windows 11 23H2 22631.3447