@@ -231,8 +231,8 @@ bool LinkerDriver::tryAddFatLTOFile(MemoryBufferRef mb, StringRef archiveName,
231231 IRObjectFile::findBitcodeInMemBuffer (mb);
232232 if (errorToBool (fatLTOData.takeError ()))
233233 return false ;
234- files.push_back (
235- make<BitcodeFile>(ctx, *fatLTOData, archiveName, offsetInArchive, lazy));
234+ files.push_back (std::make_unique<BitcodeFile>(ctx, *fatLTOData, archiveName,
235+ offsetInArchive, lazy));
236236 return true ;
237237}
238238
@@ -246,7 +246,7 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
246246 MemoryBufferRef mbref = *buffer;
247247
248248 if (ctx.arg .formatBinary ) {
249- files.push_back (make <BinaryFile>(ctx, mbref));
249+ files.push_back (std::make_unique <BinaryFile>(ctx, mbref));
250250 return ;
251251 }
252252
@@ -259,8 +259,8 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
259259 if (inWholeArchive) {
260260 for (const std::pair<MemoryBufferRef, uint64_t > &p : members) {
261261 if (isBitcode (p.first ))
262- files.push_back (
263- make<BitcodeFile>(ctx, p. first , path, p.second , false ));
262+ files.push_back (std::make_unique<BitcodeFile>(ctx, p. first , path,
263+ p.second , false ));
264264 else if (!tryAddFatLTOFile (p.first , path, p.second , false ))
265265 files.push_back (createObjFile (ctx, p.first , path));
266266 }
@@ -288,7 +288,8 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
288288 if (!tryAddFatLTOFile (p.first , path, p.second , true ))
289289 files.push_back (createObjFile (ctx, p.first , path, true ));
290290 } else if (magic == file_magic::bitcode)
291- files.push_back (make<BitcodeFile>(ctx, p.first , path, p.second , true ));
291+ files.push_back (
292+ std::make_unique<BitcodeFile>(ctx, p.first , path, p.second , true ));
292293 else
293294 Warn (ctx) << path << " : archive member '"
294295 << p.first .getBufferIdentifier ()
@@ -309,14 +310,14 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
309310 // the directory part is ignored. Note that path may be a temporary and
310311 // cannot be stored into SharedFile::soName.
311312 path = mbref.getBufferIdentifier ();
312- auto * f =
313- make<SharedFile>( ctx, mbref, withLOption ? path::filename (path) : path);
313+ auto f = std::make_unique<SharedFile>(
314+ ctx, mbref, withLOption ? path::filename (path) : path);
314315 f->init ();
315- files.push_back (f );
316+ files.push_back (std::move (f) );
316317 return ;
317318 }
318319 case file_magic::bitcode:
319- files.push_back (make <BitcodeFile>(ctx, mbref, " " , 0 , inLib));
320+ files.push_back (std::make_unique <BitcodeFile>(ctx, mbref, " " , 0 , inLib));
320321 break ;
321322 case file_magic::elf_relocatable:
322323 if (!tryAddFatLTOFile (mbref, " " , 0 , inLib))
@@ -2040,7 +2041,7 @@ void LinkerDriver::inferMachineType() {
20402041 return ;
20412042
20422043 bool inferred = false ;
2043- for (InputFile * f : files) {
2044+ for (auto & f : files) {
20442045 if (f->ekind == ELFNoneKind)
20452046 continue ;
20462047 if (!inferred) {
@@ -2530,8 +2531,9 @@ void LinkerDriver::compileBitcodeFiles(bool skipLinkedOutput) {
25302531 if (!ctx.bitcodeFiles .empty ())
25312532 markBuffersAsDontNeed (ctx, skipLinkedOutput);
25322533
2533- for (InputFile *file : lto->compile ()) {
2534- auto *obj = cast<ObjFile<ELFT>>(file);
2534+ ltoObjectFiles = lto->compile ();
2535+ for (auto &file : ltoObjectFiles) {
2536+ auto *obj = cast<ObjFile<ELFT>>(file.get ());
25352537 obj->parse (/* ignoreComdats=*/ true );
25362538
25372539 // Parse '@' in symbol names for non-relocatable output.
@@ -3039,10 +3041,9 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
30393041 auto newInputFiles = ArrayRef (ctx.driver .files ).slice (numInputFilesBeforeLTO);
30403042 if (!newInputFiles.empty ()) {
30413043 DenseSet<StringRef> oldFilenames;
3042- for (InputFile *f :
3043- ArrayRef (ctx.driver .files ).slice (0 , numInputFilesBeforeLTO))
3044+ for (auto &f : ArrayRef (ctx.driver .files ).slice (0 , numInputFilesBeforeLTO))
30443045 oldFilenames.insert (f->getName ());
3045- for (InputFile * newFile : newInputFiles)
3046+ for (auto & newFile : newInputFiles)
30463047 if (!oldFilenames.contains (newFile->getName ()))
30473048 Err (ctx) << " input file '" << newFile->getName () << " ' added after LTO" ;
30483049 }
0 commit comments