[gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and fix llvm...
authorFangrui Song <maskray@google.com>
Tue, 12 May 2020 01:43:15 +0000 (18:43 -0700)
committerFangrui Song <maskray@google.com>
Tue, 12 May 2020 04:53:53 +0000 (21:53 -0700)
commit013f06703e132c31cf3e8bdb2ae7c6b89b8f8fc2
tree4738f95964abf7fa42b1faeaafb4dccf9623cd91
parent2e9f1153c5d467ea1067e3744345a4e1ea2e9bc3
[gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and fix llvm-cov's decoding of runcount

gcov 9 (r264462) started to use GCOV_TAG_OBJECT_SUMMARY. Before,
GCOV_TAG_PROGRAM_SUMMARY was used.
libclang_rt.profile should emit just one tag according to the version.

Another bug introduced by rL194499 is that the wrong runcount field was
selected.

Fix the two bugs so that gcov can correctly decode "Runs:" from
libclang_rt.profile produced .gcda files, and llvm-cov gcov can
correctly decode "Runs:" from libgcov produced .gcda files.
21 files changed:
compiler-rt/lib/profile/GCDAProfiling.c
llvm/lib/ProfileData/GCOV.cpp
llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_missing.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_no_options.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_objdir.h.gcov
llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
llvm/test/tools/llvm-cov/Inputs/test_paths.h.gcov
llvm/test/tools/llvm-cov/gcov-4.7.c
llvm/test/tools/llvm-cov/gcov-8.c
llvm/test/tools/llvm-cov/gcov-9.c