Skip to content

Commit

Permalink
Symbolize: Remove dead code. NFCI.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pcc committed Jun 13, 2019
1 parent 2ce370c commit 0feb6e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
16 changes: 5 additions & 11 deletions llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ getDILineInfoSpecifier(FunctionNameKind FNKind) {
ErrorOr<std::unique_ptr<SymbolizableObjectFile>>
SymbolizableObjectFile::create(object::ObjectFile *Obj,
std::unique_ptr<DIContext> DICtx) {
assert(DICtx);
std::unique_ptr<SymbolizableObjectFile> res(
new SymbolizableObjectFile(Obj, std::move(DICtx)));
std::unique_ptr<DataExtractor> OpdExtractor;
Expand Down Expand Up @@ -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;
Expand All @@ -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());
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SymbolizableModule> SymMod;
Expand Down

0 comments on commit 0feb6e5

Please sign in to comment.