MaskRay wrote: I'm rejecting this. #218802 should not have landed either. The O(n^2) is fixed (20k inputs: 0.28s, vs 1.39s with #218802), but the problem is the behavior change itself.
It only changes behavior for linker options when every other input is a header (or `.hlsl`). main, this PR, and GCC 16.2.1: | Command | main | this PR | GCC | |---|---|---|---| | `a.h` | a.h.pch | a.h.pch | a.h.gch | | `a.h -lm` | pch, then link fails: `undefined symbol: main` | pch, `-lm` unused warning | gch, then link fails: `undefined symbol: main` | | `a.h -lm -o a.pch` | error: cannot specify -o when generating multiple output files | pch, warning | gch, then link fails | | `-x c++-header a.h -Wl,--as-needed -o a.pch` | error: cannot specify -o ... | pch, warning | gch, then link fails | | `a.h -Wl,--version` | pch + link | pch, warning | gch + `ld --version` | | `a.h -Xlinker --version` | pch + link | pch, warning | gch + `ld --version` | | `a.h -z now` | pch + link | pch, warning | gch, no link | | `a.h o.o` | pch + link | pch + link | gch, then link fails | | `a.h m.c -lm` | pch + a.out | pch + a.out | gch + a.out | | `-c a.h -lm` | pch, warning | pch, warning | gch | | `--config tail.cfg a.h -o a.pch` (cfg: `$-lm`) | error: cannot specify -o ... | pch | n/a | | `--config tail.cfg -c a.h -o a.pch` | pch | pch | n/a | GCC links whenever `-l`, `-Wl,`, `-Xlinker`, or an object file is present, even if all sources are headers. main matches that; this PR diverges. Without `-c`/`-S`/`-fsyntax-only`, the driver is in link mode. A header-only command line producing a PCH there is incidental, and adding linker options to it has no guaranteed behavior, in either GCC or Clang. `-c` is the way to request a PCH, and it already handles every case above, including the config file one (`$`-prefixed options are only added when linking). I'm updating the UsersManual PCH examples, which omit `-c`, to use it. Given that, we should not add `FinalPhase` to `Compilation` or thread `Inputs` through `getFinalPhase`/`getCompilationPhases` to give a specific behavior to command lines that should use `-c`. Please close this PR and don't reland #218802 in another form. The #225640 diagnostic fix is independent and can proceed on its own. https://github.com/llvm/llvm-project/pull/218802 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
