diff options
author | anjenner <161845516+anjenner@users.noreply.github.com> | 2025-04-22 09:45:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-22 09:45:15 +0100 |
commit | c3f815ba82defc84244a9688fd2578da513340fb (patch) | |
tree | cf82fdfb2e962b647d46c8bd3406171d2b887924 /llvm/lib/LTO/LTOBackend.cpp | |
parent | a35f940b876a09211f3e68dd25d00271b7195145 (diff) | |
download | llvm-c3f815ba82defc84244a9688fd2578da513340fb.zip llvm-c3f815ba82defc84244a9688fd2578da513340fb.tar.gz llvm-c3f815ba82defc84244a9688fd2578da513340fb.tar.bz2 |
Modify the localCache API to require an explicit commit on CachedFile… (#136121)
…Stream.
CachedFileStream has previously performed the commit step in its
destructor, but this means its only recourse for error handling is
report_fatal_error. Modify this to add an explicit commit() method, and
call this in the appropriate places with appropriate error handling for
the location.
Currently the destructor of CacheStream gives an assert failure in Debug
builds if commit() was not called. This will help track down any
remaining uses of the API that assume the old destructior behaviour. In
Release builds we fall back to the previous behaviour and call
report_fatal_error if the commit fails.
This is version 2 of this PR, superseding reverted PR
https://github.com/llvm/llvm-project/pull/115331 . I have incorporated a
change to the testcase to make it more reliable on Windows, as well as
two follow-up changes
(https://github.com/llvm/llvm-project/commit/df79000896101acc9b8d7435e59f767b36c00ac8
and
https://github.com/llvm/llvm-project/commit/b0baa1d8bd68a2ce2f7c5f2b62333e410e9122a1)
that were also reverted when 115331 was reverted.
---------
Co-authored-by: Augie Fackler <augie@google.com>
Co-authored-by: Vitaly Buka <vitalybuka@google.com>
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 1c764a0..dd9197e 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -460,6 +460,9 @@ static void codegen(const Config &Conf, TargetMachine *TM, if (DwoOut) DwoOut->keep(); + + if (Error Err = Stream->commit()) + report_fatal_error(std::move(Err)); } static void splitCodeGen(const Config &C, TargetMachine *TM, |