This is an archive of the discontinued LLVM Phabricator instance.

[llvm][Support] Deprecate llvm::writeFileAtomically API
ClosedPublic

Authored by hokein on Jun 26 2023, 12:29 AM.

Details

Summary

The new llvm::writeToOutput API does the same thing, and we're in favor
of it.

This patch migrates 4 exiting usages and removes the llvm::writeFileAtomically API.

Diff Detail

Event Timeline

hokein created this revision.Jun 26 2023, 12:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 12:29 AM
hokein requested review of this revision.Jun 26 2023, 12:29 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJun 26 2023, 12:29 AM

Let me know what you think about it -- I considered keeping the llvm::writeFileAtomically and migrating its underlying implementation to llvm::writeToOutput, but it doesn't seem to worth, there are only 4 in-tree usages of this API, I think it is probably better just remove it.

avl added a reviewer: jkorous.Jun 26 2023, 4:53 AM
avl added a subscriber: jkorous.

added @jkorous who originally added llvm::writeFileAtomically.

Let me know what you think about it -- I considered keeping the llvm::writeFileAtomically and migrating its underlying implementation to llvm::writeToOutput, but it doesn't seem to worth, there are only 4 in-tree usages of this API, I think it is probably better just remove it.

I think it is OK to leave only one API (f.e. llvm::writeToOutput) and remove another. It would probably be better to split this patch to lldb, thinlto, clang and removal parts.

lldb/tools/lldb-server/lldb-platform.cpp
107 ↗(On Diff #534444)

the call to llvm::writeToOutput is probably missed here.

added @jkorous who originally added llvm::writeFileAtomically.

Let me know what you think about it -- I considered keeping the llvm::writeFileAtomically and migrating its underlying implementation to llvm::writeToOutput, but it doesn't seem to worth, there are only 4 in-tree usages of this API, I think it is probably better just remove it.

I think it is OK to leave only one API (f.e. llvm::writeToOutput) and remove another. It would probably be better to split this patch to lldb, thinlto, clang and removal parts.

Sounds good. I will split it once https://reviews.llvm.org/D153652 is landed.

hokein updated this revision to Diff 536698.Jul 3 2023, 2:50 AM

Restrict the patch to only remove the writeFileAtomically API

hokein marked an inline comment as done.Jul 3 2023, 2:53 AM

Now this patch only contains the removal part of the API (I have cleaned all usages of writeFileAtomically API, except a remaining one in lldb https://reviews.llvm.org/D154329).

lldb/tools/lldb-server/lldb-platform.cpp
107 ↗(On Diff #534444)

oops, good catch, the handleError should be writeToOutput.

avl accepted this revision.Jul 3 2023, 2:25 PM

this LGTM, assuming D154329 is landed. Thank you!

This revision is now accepted and ready to land.Jul 3 2023, 2:25 PM
This revision was landed with ongoing or failed builds.Jul 6 2023, 3:29 AM
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
llvm/lib/Support/FileUtilities.cpp