From aca3df5479948eee3ee9a0cecd48dc772da70058 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 6 Dec 2017 19:08:10 +0000 Subject: [PATCH] Convert a few uses of check to checkLazy. Linking clang goes from 292.68MB to 281.80MB allocated. llvm-svn: 319927 --- lld/ELF/InputFiles.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 9bd5a73ddecd..8d80c0c032ed 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -253,13 +253,15 @@ StringRef ObjFile::getShtGroupSignature(ArrayRef Sections, // Group signatures are stored as symbol names in object files. // sh_info contains a symbol index, so we fetch a symbol and read its name. if (this->ELFSyms.empty()) - this->initSymtab( - Sections, - check(object::getSection(Sections, Sec.sh_link), toString(this))); + this->initSymtab(Sections, + checkLazy(object::getSection(Sections, Sec.sh_link), + [=]() { return toString(this); })); - const Elf_Sym *Sym = check( - object::getSymbol(this->ELFSyms, Sec.sh_info), toString(this)); - StringRef Signature = check(Sym->getName(this->StringTable), toString(this)); + const Elf_Sym *Sym = + checkLazy(object::getSymbol(this->ELFSyms, Sec.sh_info), + [=]() { return toString(this); }); + StringRef Signature = checkLazy(Sym->getName(this->StringTable), + [=]() { return toString(this); }); // As a special case, if a symbol is a section symbol and has no name, // we use a section name as a signature.