My previous fix to have FileArchive own the member MemoryBuffers was not a
complete solution for darwin because nothing owned the FileArchive object.
Fixed MachOFileNode to be like ELFFileNode and have the graph node own the
archive object.
llvm-svn: 221552
#ifndef LLD_DRIVER_DARWIN_INPUT_GRAPH_H
#define LLD_DRIVER_DARWIN_INPUT_GRAPH_H
+#include "lld/Core/ArchiveLibraryFile.h"
#include "lld/Core/InputGraph.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
void narrowFatBuffer(StringRef filePath);
MachOLinkingContext &_context;
+ std::unique_ptr<const ArchiveLibraryFile> _archiveFile;
bool _isWholeArchive;
bool _upwardDylib;
};
// If file is an archive and -all_load, then add all members.
if (ArchiveLibraryFile *archive = dyn_cast<ArchiveLibraryFile>(pf.get())) {
if (_isWholeArchive) {
- // Note: the members are added to _files, but the archive is not.
+ // Have this node own the FileArchive object.
+ _archiveFile.reset(archive);
+ pf.release();
+ // Add all members to _files vector
return archive->parseAllMembers(_files);
}
}