This is an archive of the discontinued LLVM Phabricator instance.

File::Clear() -> File::TakeStreamAndClear()

Authored by lawrence_danna on Sep 27 2019, 2:25 PM.



File::Clear() is an ugly function. It's only used in one place,
which is the swig typemaps for FILE*. This patch refactors and
renames that function to make it clear what it's really for and
why nobody else should use it.

Both File::TakeStreamAndClear() and the FILE* typemaps will be
removed in later patches after a suitable replacement is in place.

Diff Detail


Event Timeline

lawrence_danna created this revision.Sep 27 2019, 2:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2019, 2:25 PM
labath accepted this revision.Sep 29 2019, 11:27 PM

Sounds good. If this were a more permanent interface, I'd argue that the function should be called TakeStream (in analogy with llvm::Expected::takeError), but for a temporary thing that does not matter...

166–167 ↗(On Diff #222247)

FILE *stream = GetStream() ?

This revision is now accepted and ready to land.Sep 29 2019, 11:27 PM
lawrence_danna marked 2 inline comments as done.Sep 30 2019, 10:34 AM
lawrence_danna added inline comments.
166–167 ↗(On Diff #222247)

yea that's better.

This revision was automatically updated to reflect the committed changes.
lawrence_danna marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2019, 6:03 PM