This is an archive of the discontinued LLVM Phabricator instance.

[libc][NFC] Use operator delete to cleanup a File object.
ClosedPublic

Authored by sivachandra on Dec 22 2022, 11:38 AM.

Details

Summary

The File API has been refactored to allow cleanup using operator delete.

Diff Detail

Event Timeline

sivachandra created this revision.Dec 22 2022, 11:38 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 22 2022, 11:38 AM
sivachandra requested review of this revision.Dec 22 2022, 11:38 AM
lntue accepted this revision.Dec 22 2022, 12:04 PM
This revision is now accepted and ready to land.Dec 22 2022, 12:04 PM
gchatelet added inline comments.
libc/src/__support/File/file.h
206

Marking this function constexpr breaks gcc compilation as it expects all function calls down this one to be constexpr as well (i.e., File->close(), ...)

sivachandra added inline comments.Jan 3 2023, 10:25 AM
libc/src/__support/File/file.h
206

Fixed this now but it looks like we still have some way to go with similar cleanups to make it build with GCC: https://github.com/llvm/llvm-project/commit/fa715e2dad4adfe7f8922c299250b4463e1253c9

gchatelet added inline comments.Jan 4 2023, 1:56 AM
libc/src/__support/File/file.h
206

Absolutely, I'll send a few more fixes but we really need a GCC build bot to make it sustainable.