diff options
Diffstat (limited to 'llvm')
11 files changed, 52 insertions, 48 deletions
diff --git a/llvm/lib/IR/GCOV.cpp b/llvm/lib/IR/GCOV.cpp index ba92a91cc91..d4b45522822 100644 --- a/llvm/lib/IR/GCOV.cpp +++ b/llvm/lib/IR/GCOV.cpp @@ -589,8 +589,12 @@ FileInfo::openCoveragePath(StringRef CoveragePath) { /// print - Print source files with collected line count information. void FileInfo::print(raw_ostream &InfoOS, StringRef MainFilename, StringRef GCNOFile, StringRef GCDAFile) { - for (const auto &LI : LineInfo) { - StringRef Filename = LI.first(); + SmallVector<StringRef, 4> Filenames; + for (const auto &LI : LineInfo) + Filenames.push_back(LI.first()); + std::sort(Filenames.begin(), Filenames.end()); + + for (StringRef Filename : Filenames) { auto AllLines = LineConsumer(Filename); std::string CoveragePath = getCoveragePath(Filename, MainFilename); @@ -603,7 +607,7 @@ void FileInfo::print(raw_ostream &InfoOS, StringRef MainFilename, CovOS << " -: 0:Runs:" << RunCount << "\n"; CovOS << " -: 0:Programs:" << ProgramCount << "\n"; - const LineData &Line = LI.second; + const LineData &Line = LineInfo[Filename]; GCOVCoverage FileCoverage(Filename); for (uint32_t LineIndex = 0; LineIndex < Line.LastLine || !AllLines.empty(); ++LineIndex) { diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-b.output b/llvm/test/tools/llvm-cov/Inputs/test_-b.output index 515987d45ea..a6495fdaaa5 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_-b.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_-b.output @@ -1,3 +1,9 @@ +File './test.h' +Lines executed:100.00% of 1 +No branches +No calls +./test.h:creating 'test.h.gcov' + File 'test.cpp' Lines executed:84.21% of 38 Branches executed:100.00% of 15 @@ -5,9 +11,3 @@ Taken at least once:86.67% of 15 No calls test.cpp:creating 'test.cpp.gcov' -File './test.h' -Lines executed:100.00% of 1 -No branches -No calls -./test.h:creating 'test.h.gcov' - diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-f.output b/llvm/test/tools/llvm-cov/Inputs/test_-f.output index d97aa18174a..b0a73ea6706 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_-f.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_-f.output @@ -1,3 +1,9 @@ +Function '_ZN1AC1Ev' +Lines executed:100.00% of 1 + +Function '_ZN1AC2Ev' +Lines executed:100.00% of 1 + Function '_ZN1A1BEv' Lines executed:100.00% of 1 @@ -22,17 +28,11 @@ Lines executed:100.00% of 4 Function 'main' Lines executed:91.67% of 24 -Function '_ZN1AC1Ev' -Lines executed:100.00% of 1 - -Function '_ZN1AC2Ev' +File './test.h' Lines executed:100.00% of 1 +./test.h:creating 'test.h.gcov' File 'test.cpp' Lines executed:84.21% of 38 test.cpp:creating 'test.cpp.gcov' -File './test.h' -Lines executed:100.00% of 1 -./test.h:creating 'test.h.gcov' - diff --git a/llvm/test/tools/llvm-cov/Inputs/test_long_file_names.output b/llvm/test/tools/llvm-cov/Inputs/test_long_file_names.output index e09f4cb9857..e74b6365281 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_long_file_names.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_long_file_names.output @@ -1,8 +1,8 @@ -File 'srcdir/./nested_dir/../test.h' -Lines executed:100.00% of 1 -srcdir/./nested_dir/../test.h:creating 'test_paths.cpp##test.h.gcov' - File 'srcdir/./nested_dir/../test.cpp' Lines executed:84.21% of 38 srcdir/./nested_dir/../test.cpp:creating 'test_paths.cpp##test.cpp.gcov' +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test_paths.cpp##test.h.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_long_paths.output b/llvm/test/tools/llvm-cov/Inputs/test_long_paths.output index 376ee5b78df..faf3d8ae634 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_long_paths.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_long_paths.output @@ -1,8 +1,8 @@ -File 'srcdir/./nested_dir/../test.h' -Lines executed:100.00% of 1 -srcdir/./nested_dir/../test.h:creating 'srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.h.gcov' - File 'srcdir/./nested_dir/../test.cpp' Lines executed:84.21% of 38 srcdir/./nested_dir/../test.cpp:creating 'srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.cpp.gcov' +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.h.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_missing.output b/llvm/test/tools/llvm-cov/Inputs/test_missing.output index ada0c360309..a3e32dd7daa 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_missing.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_missing.output @@ -1,8 +1,8 @@ -File 'srcdir/./nested_dir/../test.h' -Lines executed:100.00% of 1 -srcdir/./nested_dir/../test.h:creating 'test.h.gcov' - File 'srcdir/./nested_dir/../test.cpp' Lines executed:84.21% of 38 srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov' +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test.h.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output b/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output index e994be72910..46efaca3e46 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_no_gcda.output @@ -1,8 +1,8 @@ -File 'test.cpp' -Lines executed:0.00% of 38 -test.cpp:creating 'test.cpp.gcov' - File './test.h' Lines executed:0.00% of 1 ./test.h:creating 'test.h.gcov' +File 'test.cpp' +Lines executed:0.00% of 38 +test.cpp:creating 'test.cpp.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_options.output b/llvm/test/tools/llvm-cov/Inputs/test_no_options.output index 8be8c1c210a..dd76811593e 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_no_options.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_no_options.output @@ -1,8 +1,8 @@ -File 'test.cpp' -Lines executed:84.21% of 38 -test.cpp:creating 'test.cpp.gcov' - File './test.h' Lines executed:100.00% of 1 ./test.h:creating 'test.h.gcov' +File 'test.cpp' +Lines executed:84.21% of 38 +test.cpp:creating 'test.cpp.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_output.output b/llvm/test/tools/llvm-cov/Inputs/test_no_output.output index 74286b9a2fc..b41e20e3255 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_no_output.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_no_output.output @@ -1,6 +1,6 @@ -File 'test.cpp' -Lines executed:84.21% of 38 - File './test.h' Lines executed:100.00% of 1 +File 'test.cpp' +Lines executed:84.21% of 38 + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output b/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output index ada0c360309..a3e32dd7daa 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output @@ -1,8 +1,8 @@ -File 'srcdir/./nested_dir/../test.h' -Lines executed:100.00% of 1 -srcdir/./nested_dir/../test.h:creating 'test.h.gcov' - File 'srcdir/./nested_dir/../test.cpp' Lines executed:84.21% of 38 srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov' +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test.h.gcov' + diff --git a/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output b/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output index 53319725563..0164f2de9c8 100644 --- a/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output +++ b/llvm/test/tools/llvm-cov/Inputs/test_preserve_paths.output @@ -1,8 +1,8 @@ -File 'srcdir/./nested_dir/../test.h' -Lines executed:100.00% of 1 -srcdir/./nested_dir/../test.h:creating 'srcdir#nested_dir#^#test.h.gcov' - File 'srcdir/./nested_dir/../test.cpp' Lines executed:84.21% of 38 srcdir/./nested_dir/../test.cpp:creating 'srcdir#nested_dir#^#test.cpp.gcov' +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'srcdir#nested_dir#^#test.h.gcov' + |

