Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class DWARFContext : public DIContext {
DWOUnits.end());
}

virtual StringRef getCompilationDirectory();
StringRef getCompilationDirectory();

/// Get compile units in the DWO context.
compile_unit_range dwo_compile_units() {
Expand Down
6 changes: 5 additions & 1 deletion llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,11 @@ void DWARFContext::dump(
}

StringRef DWARFContext::getCompilationDirectory() {
return StringRef(getCompileUnitForOffset(0)->getCompilationDir());
DWARFCompileUnit * unitForOffset = getCompileUnitForOffset(0);
if (unitForOffset == nullptr) {
return StringRef("");
}
return StringRef(unitForOffset->getCompilationDir());
}

DWARFTypeUnit *DWARFContext::getTypeUnitForHash(uint16_t Version, uint64_t Hash,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ DILineInfo SymbolizableObjectFile::symbolizeCode(object::SectionedAddress Module
// HACK: Upstream doesn't have the getCompilationDirectory() function.
std::string FullPath = LineInfo.FileName;
std::string Prefix = DebugInfoContext->getCompilationDirectory().str();
if (Prefix.back() != '/') {
if (Prefix.empty() || Prefix.back() != '/') {
Prefix.push_back('/');
}

Expand Down