Skip to content
Merged
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
15 changes: 12 additions & 3 deletions llvm/lib/IR/DebugLoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,19 @@ DebugLoc DebugLoc::getMergedLocations(ArrayRef<DebugLoc> Locs) {
return Merged;
}
DebugLoc DebugLoc::getMergedLocation(DebugLoc LocA, DebugLoc LocB) {
if (!LocA)
return LocA;
if (!LocB)
if (!LocA || !LocB) {
// If coverage tracking is enabled, prioritize returning empty non-annotated
// locations to empty annotated locations.
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
if (!LocA && LocA.getKind() == DebugLocKind::Normal)
return LocA;
if (!LocB && LocB.getKind() == DebugLocKind::Normal)
return LocB;
#endif // LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
if (!LocA)
return LocA;
return LocB;
}
return DILocation::getMergedLocation(LocA, LocB);
}

Expand Down