Skip to content

Clang breaks debuggers when using c++ modules #146536

Open
@Yuria-Shikibe

Description

@Yuria-Shikibe

Toolchain: LLVM 20.1.7 + MSVC STL; (Both clang and clang-cl are tested)
Build system: xmake;
OS: Windows11;

The formatted view is broken: (Tried both vsdbg and clion embedded LLDB 9.0)

Using #include <vector>, formatted:

Image
Image

Using import std. broken:

Image
Image

Build System Log

[  2%]: <mo_yanxi> generating.module.deps src\main.cpp
checking for D:\lib\LLVM\bin\clang-scan-deps.exe ... ok
[  2%]: <mo_yanxi> generating.module.deps C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\modules\std.ixx
[  2%]: <mo_yanxi> generating.module.deps C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\modules\std.compat.ixx
D:\lib\LLVM\bin\clang-scan-deps.exe --format=p1689 -- D:\lib\LLVM\bin\clang.exe -x c++ -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -c src\main.cpp -o build\.objs\mo_yanxi\windows\x64\debug\src\main.cpp.obj
D:\lib\LLVM\bin\clang-scan-deps.exe --format=p1689 -- D:\lib\LLVM\bin\clang.exe -x c++ -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -c "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\modules\\std.ixx" -o build\.objs\mo_yanxi\windows\x64\debug\a609f1d98a904a32bb8edcee0d1c8530\std.ixx.obj    
D:\lib\LLVM\bin\clang-scan-deps.exe --format=p1689 -- D:\lib\LLVM\bin\clang.exe -x c++ -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -c "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\modules\\std.compat.ixx" -o build\.objs\mo_yanxi\windows\x64\debug\a609f1d98a904a32bb8edcee0d1c8530\std.compat.ixx.obj
checking for flags (clang_module_file) ... ok
checking for flags (clang_module_output) ... ok
[ 17%]: <mo_yanxi> compiling.module.bmi.debug std
D:\lib\LLVM\bin\clang.exe -c -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -x c++-module --precompile -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier -Wno-deprecated-declarations -fmodule-output=build\.gens\mo_yanxi\windows\x64\debug\rules\bmi\cache\interfaces\5451787d\std.pcm -o build\.gens\mo_yanxi\windows\x64\debug\rules\bmi\cache\interfaces\5451787d\std.pcm "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\modules\\std.ixx"
checking for flags (-fdiagnostics-color=always) ... ok
checking for flags (-fansi-escape-codes) ... ok
[ 25%]: compiling.debug C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\modules\std.ixx
D:\lib\LLVM\bin\clang.exe -c -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -x c++ -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier -Wno-deprecated-declarations -o build\.objs\mo_yanxi\windows\x64\debug\a609f1d98a904a32bb8edcee0d1c8530\std.ixx.obj "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\modules\\std.ixx"
[ 43%]: compiling.debug src\main.cpp
D:\lib\LLVM\bin\clang.exe -c -Qunused-arguments -m64 --target=x86_64-windows-msvc -fms-runtime-lib=dll_dbg -g -Wall -O0 -std=c++23 -fexceptions -fcxx-exceptions -finput-charset=UTF-8 -fexec-charset=UTF-8 -fmodule-file=std=build\.gens\mo_yanxi\windows\x64\debug\rules\bmi\cache\interfaces\5451787d\std.pcm -o build\.objs\mo_yanxi\windows\x64\debug\src\main.cpp.obj src\main.cpp
checking for flags (-MMD -MF) ... ok
checking for D:\lib\LLVM\bin\clang++.exe ... ok
checking for flags (clang_ms_runtime_lib) ... ok
[ 60%]: linking.debug mo_yanxi.exe
D:\lib\LLVM\bin\clang++.exe -o build\windows\x64\debug\mo_yanxi.exe build\.objs\mo_yanxi\windows\x64\debug\src\main.cpp.obj build\.objs\mo_yanxi\windows\x64\debug\a609f1d98a904a32bb8edcee0d1c8530\std.ixx.obj -m64 --target=x86_64-windows-msvc -nostdlib -g
checking for clang ... D:\lib\LLVM\bin\clang.exe
checking for the c compiler (cc) ... clang.exe
[100%]: build ok, spent 11.016s

Complete lose track of some structs defined in modules:

Normal, complied by msvc:
Image

Blind, complied by clang:
Image
Image
(Uses the same compile options as the above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions