Closed lanza closed 1 year ago
clang seems to register the obj reader and writer during cc1_main for some reason.
https://github.com/llvm/llvm-project/blob/main/clang/tools/driver/cc1_main.cpp#L193
The default ctor for the PCH just registers the RawPCHContainer{Writer,Reader}
:
which is whats used in ccls:
https://github.com/MaskRay/ccls/blob/6dc564f2a8608fff778a7d7e8ed0d5acd8d61e6b/src/indexer.cc#L1286 https://github.com/MaskRay/ccls/blob/6dc564f2a8608fff778a7d7e8ed0d5acd8d61e6b/src/sema_manager.cc#L724
Do you have the full cmake command line including -DLLVM_ENABLE_MODULES=on
when configuring llvm-project?
I think in the ccls build, the value of LLVM_ENABLE_MODULES
should match llvm-project
's.
Do you have the full cmake command line including -DLLVM_ENABLE_MODULES=on when configuring llvm-project? I think in the ccls build, the value of LLVM_ENABLE_MODULES should match llvm-project's.
Sorry I'm not talking of the build of ccls itself, I'm using ccls as my LSP while editing clang.
I reduced it to a minimal repro:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.20)
project(test CXX)
set(CMAKE_CXX_FLAGS -gmodules)
add_executable(main main.cpp)
main.cpp:
int main() {}
Thanks for the report. Fixed by 8bc3959537adae26b470c8223845555ea26693cc
Similar to libclang https://github.com/llvm/llvm-project/commit/a3e2ff19e59c587ea14611eb64400c6d0ecabcee
I didn't look too much into it, I just ended up disabling the module build. But I had:
ccls was crashing here: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Frontend/CompilerInstance.h#L549
getHeaderSearchOpts().ModuleFormat;
wasobj
.