Ignore path rewrites for files that exist. The avoids testing problems caused by symlinks in the build area. For example:
/path -> /tmp/path
<configure LLVM in /path/to/sources to be built into /path/to/build>
llvm-cov testcase:
// RUN: llvm-cov show %t -instr-profile %t.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck %s
Expands to:
llvm-cov show /tmp/path/to/build/test.cpp.tmp -instr-profile \ /tmp/path/to/build/test.cpp.tmp.profdata \ -path-equivalence=/tmp,/tmp/path/to/sources 2>&1 \ | FileCheck /tmp/path/to/sources/test.cpp
Which results in llvm-cov looking for /tmp/path/to/sources/path/to/sources/test.cpp which doesn't exist.
With this change, /tmp/path/to/sources will not be remapped because /tmp/path/to/sources/test.cpp exists.
In general, this change solves problems with tools that invoke llvm-cov after expanding paths containing symlinks to nested path components.