Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang c++20 modules missing information in compile_commands.json exported #1167

Closed
Shuenhoy opened this issue Dec 26, 2020 · 7 comments
Closed

Comments

@Shuenhoy
Copy link

Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.

Describe the bug

In current version, the compile_commands.json file generated with xmake when using clang11 c++20 modules lost the options "-fmodule-file=xxx.pcm, which would make clangd cannot find the module I am importing.

Expected behavior

The compile_commands.json should add the option mentioned.

Error output

If applicable, please add verbose the errors output to help us analyze your problem.

If it is a xmake related compilation problem, please add the -v -D parameter and give the detailed compilation output information.

Related Environment

Please provide compiling and running environment information:

  • xmake version: 2.3.9
  • os: Linux Mint 20
  • target platform: x86_64 linux

Additional context

Add any other context about the problem here.

@waruqi
Copy link
Member

waruqi commented Dec 26, 2020

Yes, it is not currently supported, maybe I will consider supporting it on 2.5.2

related issue. #1148

@waruqi waruqi added this to the v2.5.2 milestone Dec 26, 2020
@Shuenhoy
Copy link
Author

Shuenhoy commented Dec 26, 2020

FYI, I just found probably a simpler way to get things work. Current module.mpp would generate module.mpp.o.pcm, if we make the naming pattern to module.pcm, then we can just add a -fprebuilt-module-path=xx instead of adding module-file for each pcm file.


UPDATE: there is a drawback. The file name must be exactly the same with the module name, or clangd still cannot found. The previous way should be better.

@waruqi
Copy link
Member

waruqi commented Dec 26, 2020

ok, thanks. I will improve c++20 modules on 2.5.2. In addition, I will also support c++20 modules for gcc.

@waruqi
Copy link
Member

waruqi commented Aug 15, 2022

we have supported it, you can try cxxmodules branch. #2641

However, vscode and other editor/ide should not yet support complie_commands with c++modules.

@waruqi waruqi modified the milestones: todo, v2.7.1 Aug 15, 2022
@waruqi
Copy link
Member

waruqi commented Aug 15, 2022

but vscode and other some ide maybe still not support compile_commands.json with c++modules.

microsoft/vscode-cpptools#6302 (comment)

@Shuenhoy
Copy link
Author

but vscode and other some ide maybe still not support compile_commands.json with c++modules.

I have made some try with compile_commands.json manually generated, with clangd extension and clang, and it works in general. vscode-cpptools extension still does not work as your reference, nor does clangd with gcc.

However, I have to admit that the whole module thing is still not useable with gcc and clang. There are just too many ICEs. The compiler just crashes for the simple codes. Really hope the situation would change next year.

@waruqi
Copy link
Member

waruqi commented Aug 16, 2022

yes, and I have merged it now.

@waruqi waruqi closed this as completed Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants