This is an archive of the discontinued LLVM Phabricator instance.

Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI.
ClosedPublic

Authored by pcc on Jun 24 2016, 8:14 PM.

Details

Summary

The NewArchiveIterator class has a problem: it requires too much context. Any
memory buffers added to the archive must be stored within an Archive::Member,
which must have an associated Archive. This makes it harder than necessary
to create new archive members (or new archives entirely) from scratch using
memory buffers.

This patch replaces NewArchiveIterator with a NewArchiveMember class that
stores just the memory buffer and the information that goes into the archive
member header.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 61881.Jun 24 2016, 8:14 PM
pcc retitled this revision from to Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI..
pcc updated this object.
pcc added a reviewer: rafael.
pcc added a subscriber: llvm-commits.
rafael edited edge metadata.Jun 28 2016, 6:50 PM

I like the general idea.

include/llvm/Object/ArchiveWriter.h
25 ↗(On Diff #61881)

Getting the time in here seems really odd.

32 ↗(On Diff #61881)

Passing &EC to constructor is a really nasty thing. How about a private constructor and a static method that returns an Expected?

pcc updated this revision to Diff 62179.Jun 28 2016, 10:11 PM
pcc marked an inline comment as done.
pcc edited edge metadata.
  • Improved error handling
pcc added inline comments.Jun 28 2016, 10:11 PM
include/llvm/Object/ArchiveWriter.h
25 ↗(On Diff #61881)

Hm? This is the (constant) epoch, not the current time.

rafael accepted this revision.Jun 29 2016, 12:29 PM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 29 2016, 12:29 PM
This revision was automatically updated to reflect the committed changes.