[PATCH] D157913: [Coverage] Allow Clang coverage to be used with debug info correlation.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 10:13:02 PDT 2023


zequanwu added inline comments.


================
Comment at: compiler-rt/test/profile/Darwin/coverage-debug-info-correlate.cpp:29
+
+// RUN: llvm-cov report --instr-profile=%t.profdata %t | FileCheck %s -check-prefix=NONAME
+
----------------
ellis wrote:
> Is it worth testing that `%t.normal.profdata` emits the same coverage?
Added testing for `%t.normal.profdata`.


================
Comment at: llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp:1019-1029
+  if (auto E = NamesSection.takeError()) {
+    if (ProfileNames.isEmpty())
+      return std::move(E);
+    consumeError(std::move(E));
+  } else {
+    std::vector<SectionRef> NamesSectionRefs = *NamesSection;
+    if (NamesSectionRefs.size() != 1)
----------------
ellis wrote:
> I don't quite understand why this was changed. Is there is a test case that covers this?
This part of code is used by llvm-cov. Originally, it always checks if the instrumented binary contains the `__llvm_prf_names ` section and assumes all instrumented function names are store there. Now, it will firstly create `InstrProfSymtab` from the indexed profile file and add remaining function names to this `InstrProfSymtab` from `__llvm_prf_names` section in the instrumented binary, if there is one. 

This is covered by `// RUN: llvm-cov export --format=lcov --instr-profile=%t.profdata %t | FileCheck %s -check-prefix=NAME`, where `_Z9used_funcv` and `main` are stored in debug info and later moved to indexed profile file, and `_ZN1A11unused_funcEv` is stored in `__llvm_prf_names` section in the binary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157913/new/

https://reviews.llvm.org/D157913



More information about the cfe-commits mailing list