This is an archive of the discontinued LLVM Phabricator instance.

Frontend: Fix layering between create{,Default}OutputFile, NFC
ClosedPublic

Authored by dexonsmith on Dec 14 2020, 2:33 PM.

Details

Summary

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 createOutputFiles 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.

Diff Detail

Event Timeline

dexonsmith created this revision.Dec 14 2020, 2:33 PM
dexonsmith requested review of this revision.Dec 14 2020, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2020, 2:33 PM
This revision is now accepted and ready to land.Jan 26 2021, 2:24 PM
This revision was landed with ongoing or failed builds.Jan 26 2021, 3:56 PM
This revision was automatically updated to reflect the committed changes.