mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Disallow Archive::child_iterator that don't point to an archive.
NFC, just less error prone. llvm-svn: 241747
This commit is contained in:
parent
c78312ed70
commit
aa281f8938
@ -109,7 +109,6 @@ public:
|
||||
Child child;
|
||||
|
||||
public:
|
||||
child_iterator() : child(Child(nullptr, nullptr)) {}
|
||||
child_iterator(const Child &c) : child(c) {}
|
||||
const Child *operator->() const { return &child; }
|
||||
const Child &operator*() const { return child; }
|
||||
|
@ -24,14 +24,14 @@ class NewArchiveIterator {
|
||||
bool IsNewMember;
|
||||
StringRef Name;
|
||||
|
||||
union {
|
||||
object::Archive::child_iterator OldI;
|
||||
|
||||
StringRef NewFilename;
|
||||
};
|
||||
|
||||
public:
|
||||
NewArchiveIterator(object::Archive::child_iterator I, StringRef Name);
|
||||
NewArchiveIterator(StringRef I, StringRef Name);
|
||||
NewArchiveIterator();
|
||||
bool isNewMember() const;
|
||||
StringRef getName() const;
|
||||
|
||||
|
@ -207,7 +207,8 @@ ErrorOr<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) {
|
||||
}
|
||||
|
||||
Archive::Archive(MemoryBufferRef Source, std::error_code &ec)
|
||||
: Binary(Binary::ID_Archive, Source), SymbolTable(child_end()) {
|
||||
: Binary(Binary::ID_Archive, Source), SymbolTable(child_end()),
|
||||
StringTable(child_end()), FirstRegular(child_end()) {
|
||||
StringRef Buffer = Data.getBuffer();
|
||||
// Check for sufficient magic.
|
||||
if (Buffer.startswith(ThinMagic)) {
|
||||
|
@ -34,8 +34,6 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
NewArchiveIterator::NewArchiveIterator() {}
|
||||
|
||||
NewArchiveIterator::NewArchiveIterator(object::Archive::child_iterator I,
|
||||
StringRef Name)
|
||||
: IsNewMember(false), Name(Name), OldI(I) {}
|
||||
|
@ -535,7 +535,8 @@ computeNewArchiveMembers(ArchiveOperation Operation,
|
||||
assert(unsigned(InsertPos) <= Ret.size());
|
||||
Ret.insert(Ret.begin() + InsertPos, Moved.begin(), Moved.end());
|
||||
|
||||
Ret.insert(Ret.begin() + InsertPos, Members.size(), NewArchiveIterator());
|
||||
Ret.insert(Ret.begin() + InsertPos, Members.size(),
|
||||
NewArchiveIterator("", ""));
|
||||
int Pos = InsertPos;
|
||||
for (auto &Member : Members) {
|
||||
StringRef Name = sys::path::filename(Member);
|
||||
|
Loading…
x
Reference in New Issue
Block a user