[clang-tools-extra] [clangd][modules] Remove the options that is for gcc, make modules work for clangd when using gcc (PR #200001)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 1 01:12:45 PDT 2026
ChuanqiXu9 wrote:
> > > I'm not convinced that simply removing these flags would solve the problem. Clangd should be ignoring the flags, so they are noise on top of the behavior of clangd. As such, I would like to see confirmation first that this works without this change.
> >
> >
> > I have debugged many times. And have compared the command that clang++ used with that gcc is using. Then I found these options are redundant. In fact, clang++ also removes the mapfile in its commands, for example @CMakeFiles/.../abc.modmap. So what I have changed is meaningful
>
> It looks like we can just create `.clangd` config to remove these flags. I.e.
>
> ```
> CompileFlags:
> Remove: [-fmodule*, -fdeps-*]
> ```
>
> And after that everything seems working fine
>
> However, I also found that seems we don't forward command mangler right to modules dependency scanner, because I see some errors in logs:
>
> ```
> E[10:34:07.505] Scanning modules dependencies for .../module-import/Use.cc failed: error: unknown argument: '-fmodules-ts'
> error: unknown argument: '-fmodule-mapper=CMakeFiles/Use.dir/Use.cc.o.modmap'
> error: unknown argument: '-fdeps-format=p1689r5'
>
> E[10:34:07.506] The command line the scanning tool use is: /usr/bin/g++-14 --driver-mode=g++ -O3 -DNDEBUG -std=gnu++20 -fmodules-ts -fmodule-mapper=CMakeFiles/Use.dir/Use.cc.o.modmap -MD -fdeps-format=p1689r
> ```
Seems to be a regression bug as we have https://github.com/llvm/llvm-project/pull/122606
https://github.com/llvm/llvm-project/pull/200001
More information about the cfe-commits
mailing list