[PATCH] D93248: Frontend: Fix layering between create{,Default}OutputFile, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 14:33:31 PST 2020


dexonsmith created this revision.
dexonsmith added a reviewer: erik.pilkington.
Herald added subscribers: ributzka, jfb.
dexonsmith requested review of this revision.
Herald added a project: clang.

Fix layering between `CompilerInstance::createDefaultOutputFile` and the
two versions of `createOutputFile`.

- Add missing configuration flags to `createDefaultOutputFile` so that GeneratePCHAction and GenerateModuleFromModuleMapAction can use it. They previously promised that temporary files were turned on; now `createDefaultOutputFile` handles that logic.
- Lift the logic handling `InFile` and `Extension` to `createDefaultOutputFile`, since it's only the callers of that function that are using it.
- Rename the deeper of the two `createOutputFile`s to `createOutputFileImpl` and make it private to `CompilerInstance` (to prove that no one else is using it).
- Sink the logic for adding to `CompilerInstance::OutputFiles` down to `createOutputFileImpl`, allowing two "optional" (but always used) `std::string*` out parameters to be removed.
- Instead of passing a `std::error_code` out parameter into `createOutputFileImpl`, have it return `Expected<>`.
- As a drive-by, inline `CompilerInstance::addOutputFile` into its only caller, `createOutputFileImpl`.

Clean layering makes it easier for a future commit to extract
`createOutputFileImpl` out of `CompilerInstance`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93248

Files:
  clang/include/clang/Frontend/CompilerInstance.h
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/FrontendActions.cpp
  clang/tools/driver/cc1_main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93248.311713.patch
Type: text/x-patch
Size: 14435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201214/c29369ca/attachment-0001.bin>


More information about the cfe-commits mailing list