naveen-seth wrote: Currently, the `-cc1` jobs for `std.cppm` and `std.compat.cppm` are generated in the same way as any other `.cppm` input specified on the `-fmodules-driver` command line. We implicitly add them to the input list at the beginning of `BuildCompilation`, and remove them later if they are not needed. (This is done because all -cc1 jobs need to exist before the dependency scan. The -cc1 jobs for the Standard library modules are still only scanned if really needed.)
For this command line: ``` clang++ -std=c++23 -fmodules-driver main.cpp ``` we would get: ``` clang -cc1 -emit-obj -o /tmp/std.o -fmodules-reduced-bmi -fmodule-output=... clang -cc1 -emit-obj -o /tmp/std.compat.o -fmodules-reduced-bmi -fmodule-output=... clang -cc1 -emit-obj -o /tmp/main.o ... ``` This is bad because we do not need to compile object files for the standard library modules. Instead, we only want something like: ``` clang -cc1 -emit-reduced-bmi -o /tmp/std.pcm ``` Because `std.cppm` is currently handled like any other `.cppm` input, this also causes problems with `-o`, since `-o` is usually not allowed with multiple inputs. The Standard library modules are a special kind of input that needs special handling during `BuildCompilation`, so adding a dedicated input kind for them solves these problems. https://github.com/llvm/llvm-project/pull/199289 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
