Skip to content

Commit 0a7f417

Browse files
committed
Revert "[llvm-cov] don't include all source files when provided source files are filtered out"
This reverts commit c2bd20ef652 and the follow up fix 16605bba6fb. The tools/llvm-cov/warnings.h continues to fail on Windows platforms even after the follow up, for example on the llvm-clang-win-x-armv7l builder: http://lab.llvm.org:8011/#/builders/60/builds/94
1 parent 98f2549 commit 0a7f417

File tree

5 files changed

+8
-26
lines changed

5 files changed

+8
-26
lines changed

llvm/test/tools/llvm-cov/native_separators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// RUN: llvm-profdata merge %S/Inputs/double_dots.proftext -o %t.profdata
99
// RUN: llvm-cov show %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -o %t.dir
1010
// RUN: FileCheck -check-prefixes=TEXT-INDEX -input-file=%t.dir/index.txt %s
11-
// RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %S/../llvm-"config"/../llvm-"cov"/native_separators.c -o %t.dir
11+
// RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S ../llvm-"config"/../llvm-"cov"/native_separators.c -o %t.dir
1212
// RUN: FileCheck -check-prefixes=HTML-INDEX -input-file=%t.dir/index.html %s
1313
// RUN: llvm-cov show -format=html %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S %s -o %t.dir
1414
// RUN: FileCheck -check-prefixes=HTML -input-file=%t.dir/coverage/tmp/native_separators.c.html %s

llvm/test/tools/llvm-cov/sources-specified.test

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ RUN: %S/Inputs/sources_specified/main.covmapping \
1010
RUN: %S/Inputs/sources_specified/main.cc %S/Inputs/sources_specified/extra \
1111
RUN: | FileCheck -check-prefix=SHOW %s
1212

13-
# Don't include all source files when provided source files are filtered out.
14-
RUN: llvm-cov show -instr-profile %S/Inputs/sources_specified/main.profdata \
15-
RUN: -path-equivalence=/tmp,%S/Inputs \
16-
RUN: %S/Inputs/sources_specified/main.covmapping \
17-
RUN: --ignore-filename-regex='.*' \
18-
RUN: %S/Inputs/sources_specified/main.cc %S/Inputs/sources_specified/extra \
19-
RUN: | FileCheck -allow-empty -check-prefix=IGNORE %s
20-
21-
IGNORE-NOT: {{.*}}main.cc{{.*}}
22-
IGNORE-NOT: {{.*}}inc.h{{.*}}
23-
IGNORE-NOT: {{.*}}dec.h{{.*}}
24-
2513
# Order of files may differ, check the total values calculated.
2614
REPORT-NOT: {{.*}}abs.h{{.*}}
2715
REPORT: {{^}}TOTAL 3{{.*}}72.73%

llvm/test/tools/llvm-cov/universal_bin_wrapping_archives.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ REQUIRES: zlib
1717
RUN: llvm-profdata merge %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives.proftext -o %t.profdata
1818

1919
RUN: llvm-cov show %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
20-
RUN: -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives -arch i386 \
20+
RUN: -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives %s -arch i386 \
2121
RUN: | FileCheck %s --check-prefix=SHOW_ARCHIVE
2222

2323
RUN: llvm-cov show %S/Inputs/universal_bin_wrapping_archives/universal_bin_wrapping_archives \
24-
RUN: -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives -arch x86_64 \
24+
RUN: -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs/universal_bin_wrapping_archives %s -arch x86_64 \
2525
RUN: | FileCheck %s --check-prefix=SHOW_ARCHIVE
2626

2727
SHOW_ARCHIVE: {{.*}}obj1.c:

llvm/test/tools/llvm-cov/warnings.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S | FileCheck %s -allow-empty -check-prefix=FAKE-FILE-STDOUT
2-
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck %s -check-prefix=FAKE-FILE-STDERR
1+
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S /dev/null | FileCheck %s -allow-empty -check-prefix=FAKE-FILE-STDOUT
2+
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S /dev/null 2>&1 | FileCheck %s -check-prefix=FAKE-FILE-STDERR
33
// RUN: not llvm-cov report %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -format=html
44
// RUN: not llvm-cov export %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -format=html
55

66
// FAKE-FILE-STDOUT-NOT: warning: The file '{{.*}}' isn't covered.
77
// FAKE-FILE-STDERR: warning: The file '{{.*}}' isn't covered.
88

9-
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S -name ".*" | FileCheck %s -allow-empty -check-prefix=FAKE-FUNC-STDOUT
10-
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S -name-regex ".*" 2>&1 | FileCheck %s -check-prefix=FAKE-FUNC-STDERR
9+
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S -name ".*" /dev/null | FileCheck %s -allow-empty -check-prefix=FAKE-FUNC-STDOUT
10+
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -path-equivalence=/tmp,%S -name-regex ".*" /dev/null 2>&1 | FileCheck %s -check-prefix=FAKE-FUNC-STDERR
1111

1212
// FAKE-FUNC-STDOUT-NOT: warning: Could not read coverage for '{{.*}}'.
1313
// FAKE-FUNC-STDERR: Could not read coverage for '{{.*}}'.

llvm/tools/llvm-cov/CodeCoverage.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ class CodeCoverageTool {
130130
CoverageFiltersMatchAll Filters;
131131
CoverageFilters IgnoreFilenameFilters;
132132

133-
/// True if InputSourceFiles are provided.
134-
bool HadSourceFiles = false;
135-
136133
/// The path to the indexed profile.
137134
std::string PGOFilename;
138135

@@ -197,7 +194,6 @@ void CodeCoverageTool::addCollectedPath(const std::string &Path) {
197194
sys::path::remove_dots(EffectivePath, /*remove_dot_dots=*/true);
198195
if (!IgnoreFilenameFilters.matchesFilename(EffectivePath))
199196
SourceFiles.emplace_back(EffectivePath.str());
200-
HadSourceFiles = !SourceFiles.empty();
201197
}
202198

203199
void CodeCoverageTool::collectPaths(const std::string &Path) {
@@ -401,7 +397,6 @@ void CodeCoverageTool::remapPathNames(const CoverageMapping &Coverage) {
401397
sys::path::native(Path, NativePath);
402398
if (!sys::path::is_separator(NativePath.back()))
403399
NativePath += sys::path::get_separator();
404-
sys::path::remove_dots(NativePath, true);
405400
return NativePath.c_str();
406401
};
407402
std::string RemapFrom = nativeWithTrailing(PathRemapping->first);
@@ -411,7 +406,6 @@ void CodeCoverageTool::remapPathNames(const CoverageMapping &Coverage) {
411406
for (StringRef Filename : Coverage.getUniqueSourceFiles()) {
412407
SmallString<128> NativeFilename;
413408
sys::path::native(Filename, NativeFilename);
414-
sys::path::remove_dots(NativeFilename, true);
415409
if (NativeFilename.startswith(RemapFrom)) {
416410
RemappedFilenames[Filename] =
417411
RemapTo + NativeFilename.substr(RemapFrom.size()).str();
@@ -901,7 +895,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
901895

902896
auto Printer = CoveragePrinter::create(ViewOpts);
903897

904-
if (SourceFiles.empty() && !HadSourceFiles)
898+
if (SourceFiles.empty())
905899
// Get the source files from the function coverage mapping.
906900
for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
907901
if (!IgnoreFilenameFilters.matchesFilename(Filename))

0 commit comments

Comments
 (0)