aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAndrzej Warzynski <andrzej.warzynski@arm.com>2021-08-18 16:14:09 +0000
committerAndrzej Warzynski <andrzej.warzynski@arm.com>2021-08-20 06:46:44 +0000
commitfd21d1e198e381a2b9e7af1701044462b2d386cd (patch)
tree37692aadf338ce84f9da495bdf5d87352c7101aa /clang/lib/CodeGen/CodeGenFunction.cpp
parentb460534ac7a744abce2c0608fee08c1ce2a8c651 (diff)
downloadllvm-fd21d1e198e381a2b9e7af1701044462b2d386cd.zip
llvm-fd21d1e198e381a2b9e7af1701044462b2d386cd.tar.gz
llvm-fd21d1e198e381a2b9e7af1701044462b2d386cd.tar.bz2
[flang] Refine output file generation
This patch refactors the file generation API in Flang's frontend driver. It improves the layering between `CreateDefaultOutputFile`, `CreateOutputFile` (`CompilerInstance` methods) and their various clients. List of changes: * Rename `CreateOutputFile` as `CreateOutputFileImpl` and make it private. This method is an implementation detail. * Instead of passing an `std::error_code` out parameter into `CreateOutputFileImpl`, have it return Expected<>. This is a bit shorter and more idiomatic LLVM. * Make `CreateDefaultOutputFile` (which calls `CreateOutputFileImpl`) issue an error when file creation fails. The error code from `CreateOutputFileImpl` is used to generate a meaningful diagnostic message. * Remove error reporting from `PrintPreprocessedAction::ExecuteAction`. This is only for cases when output file generation fails. This is handled in `CreateDefaultOutputFile` instead (see the previous point). * Inline `AddOutputFile` into its only caller, `CreateDefaultOutputFile`. * Switch from `lvm::buffer_ostream` to `llvm::buffer_unique_ostream>` for non-seekable output streams. This simplifies the logic in the driver and was introduced for this very reason in [1] * Moke sure that the diagnostics from the prescanner when running `-E` (`PrintPreprocessedAction::ExecuteAction`) are printed before the actual output is generated. * Update comments, add test. [1] https://reviews.llvm.org/D93260 Differential Revision: https://reviews.llvm.org/D108390
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions