[PATCH] D108390: [flang] Refine output file generation
Andrzej Warzynski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 19 10:17:55 PDT 2021
awarzynski created this revision.
Herald added a reviewer: sscalpone.
awarzynski requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
- 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 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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108390
Files:
flang/include/flang/Frontend/CompilerInstance.h
flang/lib/Frontend/CompilerInstance.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/test/Driver/output-paths.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108390.367543.patch
Type: text/x-patch
Size: 8233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210819/48d8c424/attachment.bin>
More information about the llvm-commits
mailing list