[llvm-cov] Check path emptyness in path-equivalence after removing dots.

This commit is contained in:
Zequan Wu 2021-03-24 17:54:26 -07:00
parent 9a82f42d12
commit dd388ba3e0

View file

@ -475,7 +475,7 @@ void CodeCoverageTool::remapPathNames(const CoverageMapping &Coverage) {
SmallString<128> NativePath;
sys::path::native(Path, NativePath);
sys::path::remove_dots(NativePath, true);
if (!sys::path::is_separator(NativePath.back()))
if (!NativePath.empty() && !sys::path::is_separator(NativePath.back()))
NativePath += sys::path::get_separator();
return NativePath.c_str();
};