Convert a few uses of check to checkLazy.

Linking clang goes from 292.68MB to 281.80MB allocated.

llvm-svn: 319927
This commit is contained in:
Rafael Espindola 2017-12-06 19:08:10 +00:00
parent 5b491a29fb
commit aca3df5479
1 changed files with 8 additions and 6 deletions

View File

@ -253,13 +253,15 @@ StringRef ObjFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> 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<ELFT>(Sections, Sec.sh_link), toString(this)));
this->initSymtab(Sections,
checkLazy(object::getSection<ELFT>(Sections, Sec.sh_link),
[=]() { return toString(this); }));
const Elf_Sym *Sym = check(
object::getSymbol<ELFT>(this->ELFSyms, Sec.sh_info), toString(this));
StringRef Signature = check(Sym->getName(this->StringTable), toString(this));
const Elf_Sym *Sym =
checkLazy(object::getSymbol<ELFT>(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.