From 0feb6e52f18e68f74746cdcd2c52400bf49d54ed Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 13 Jun 2019 22:49:34 +0000 Subject: [PATCH] Symbolize: Remove dead code. NFCI. The only caller of SymbolizableObjectFile::create passes a non-null DebugInfoContext and asserts that they do so. Move the assert into SymbolizableObjectFile::create and remove null checks. Differential Revision: https://reviews.llvm.org/D63298 llvm-svn: 363334 --- .../Symbolize/SymbolizableObjectFile.cpp | 16 +++++----------- llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp index fc529630e979..62f849f5a959 100644 --- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp +++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp @@ -44,6 +44,7 @@ getDILineInfoSpecifier(FunctionNameKind FNKind) { ErrorOr> SymbolizableObjectFile::create(object::ObjectFile *Obj, std::unique_ptr DICtx) { + assert(DICtx); std::unique_ptr res( new SymbolizableObjectFile(Obj, std::move(DICtx))); std::unique_ptr OpdExtractor; @@ -244,16 +245,12 @@ DILineInfo SymbolizableObjectFile::symbolizeCode(object::SectionedAddress ModuleOffset, FunctionNameKind FNKind, bool UseSymbolTable) const { - DILineInfo LineInfo; - if (ModuleOffset.SectionIndex == object::SectionedAddress::UndefSection) ModuleOffset.SectionIndex = getModuleSectionIndexForAddress(ModuleOffset.Address); + DILineInfo LineInfo = DebugInfoContext->getLineInfoForAddress( + ModuleOffset, getDILineInfoSpecifier(FNKind)); - if (DebugInfoContext) { - LineInfo = DebugInfoContext->getLineInfoForAddress( - ModuleOffset, getDILineInfoSpecifier(FNKind)); - } // Override function name from symbol table if necessary. if (shouldOverrideWithSymbolTable(FNKind, UseSymbolTable)) { std::string FunctionName; @@ -269,15 +266,12 @@ SymbolizableObjectFile::symbolizeCode(object::SectionedAddress ModuleOffset, DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode( object::SectionedAddress ModuleOffset, FunctionNameKind FNKind, bool UseSymbolTable) const { - DIInliningInfo InlinedContext; - if (ModuleOffset.SectionIndex == object::SectionedAddress::UndefSection) ModuleOffset.SectionIndex = getModuleSectionIndexForAddress(ModuleOffset.Address); + DIInliningInfo InlinedContext = DebugInfoContext->getInliningInfoForAddress( + ModuleOffset, getDILineInfoSpecifier(FNKind)); - if (DebugInfoContext) - InlinedContext = DebugInfoContext->getInliningInfoForAddress( - ModuleOffset, getDILineInfoSpecifier(FNKind)); // Make sure there is at least one frame in context. if (InlinedContext.getNumberOfFrames() == 0) InlinedContext.addFrame(DILineInfo()); diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 27632a10bad8..edb440a03c95 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -425,7 +425,6 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) { Context = DWARFContext::create(*Objects.second, nullptr, DWARFContext::defaultErrorHandler, Opts.DWPName); - assert(Context); auto InfoOrErr = SymbolizableObjectFile::create(Objects.first, std::move(Context)); std::unique_ptr SymMod; -- GitLab