diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h --- a/llvm/include/llvm/Object/ELFObjectFile.h +++ b/llvm/include/llvm/Object/ELFObjectFile.h @@ -530,10 +530,10 @@ // If the symbol name is empty use the section name. if ((*SymOrErr)->getType() == ELF::STT_SECTION) { - if (Expected SecOrErr = getSymbolSection(Sym)) { - consumeError(Name.takeError()); + Expected SecOrErr = getSymbolSection(Sym); + if (SecOrErr) return (*SecOrErr)->getName(); - } + return SecOrErr.takeError(); } return Name; }