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

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 17:54:47 PDT 2021


Author: Zequan Wu
Date: 2021-03-24T17:54:38-07:00
New Revision: dd388ba3e0b0a5f06565d0bcb6e1aebb5daac065

URL: https://github.com/llvm/llvm-project/commit/dd388ba3e0b0a5f06565d0bcb6e1aebb5daac065
DIFF: https://github.com/llvm/llvm-project/commit/dd388ba3e0b0a5f06565d0bcb6e1aebb5daac065.diff

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

Added: 
    

Modified: 
    llvm/tools/llvm-cov/CodeCoverage.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 712766ec9929..144f338b10ed 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -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();
   };


        


More information about the llvm-commits mailing list