This copies over some functionality we have in ELF/Error.{cpp,h} and makes it available in COFF/Error.{cpp,h}
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'm refactoring the COFF linker's LTO support to use the new LTO API. To keep the code as similar as possible to what we do in the ELF linker, I'll be re-using some code that uses the functions being added here.
COFF/Config.h | ||
---|---|---|
83 ↗ | (On Diff #84355) | You don't seem to set a value to ColorDiagnostics. Does this mean it error messages are always printed in black/white? Doesn't Process::StandardErrHasColors work for Windows? |
COFF/Error.h | ||
26 ↗ | (On Diff #84355) | This was removed from ELF, so you don't want to add it to COFF. You can always do error("somthing failed: " + EC.message()) instead of error(EC, "something failed"). |
Thanks for taking a look, @ruiu. I'll remove the functions that no longer exist in ELF. As for colors, I didn't need that for what I was doing, so I didn't make it do anything. Want me to include that in this patch or in a follow-up?
If you are not going to set a value to Config->ColorDiagnostics, if (Config->ColorDiagnostics) part is dead code, but I don't think we want to check in dead code. How about adding this one line to the driver?
Config->Diagnostics = (ErrorOS == llvm::errs() && Process::StandardErrHasColors());
Changes requested by @ruiu:
- Only add error(const Twine &Msg), not the variant that has since been removed.
- Initialize Config->ColorDiagnostics based on color support in error stream.
- Also updated existing code to use Config->ColorDiagnostics, instead of using its own detection.
- Updated the title of the change to reflect that we're only adding error() and warn().
COFF/Config.h | ||
---|---|---|
87 ↗ | (On Diff #84366) | Since this is always true, please remove the variable. |
83 ↗ | (On Diff #84355) | nit: remove = false as the default value will always be overwrote. |
COFF/Error.cpp | ||
15 ↗ | (On Diff #84366) | Are you actually using this header? |
68–69 ↗ | (On Diff #84366) | It is OK to call exitLld unconditionally in COFF. |
99–102 ↗ | (On Diff #84366) | I think you want to remove this code and Config::FatalWarnings. (This is using an uninitialized value.) |
COFF/Error.cpp | ||
---|---|---|
15 ↗ | (On Diff #84366) | llvm_shutdown() (used in exitLld) comes from that header. |
Changes requested by @ruiu:
- Removed Config->ExitEarly and Config->FatalWarnings and the code that checks their values.
COFF/Error.cpp | ||
---|---|---|
98–99 ↗ | (On Diff #84385) | Nope...that's a bug I just introduced. Fixing... |
Use exitLld instead of _exit in fatal(), make warn() not fatal, and mark exitLld() noreturn.
lld/trunk/COFF/Error.cpp | ||
---|---|---|
67 | It looks like this isn't actually configurable in the COFF linker. |
It looks like this isn't actually configurable in the COFF linker.