[all-commits] [llvm/llvm-project] 5fbd1a: [Coverage] Store compilation dir separately in cov...

Petr Hosek via All-commits all-commits at lists.llvm.org
Thu Feb 18 14:35:02 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fbd1a333aa1a0b70903d036b98ea56c51ae5224
      https://github.com/llvm/llvm-project/commit/5fbd1a333aa1a0b70903d036b98ea56c51ae5224
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-02-18 (Thu, 18 Feb 2021)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    M clang/lib/CodeGen/CoverageMappingGen.h
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/CodeGen/profile-compilation-dir.c
    M clang/test/CoverageMapping/abspath.cpp
    M clang/test/Profile/profile-prefix-map.c
    M compiler-rt/include/profile/InstrProfData.inc
    M llvm/docs/CoverageMappingFormat.rst
    M llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
    M llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
    M llvm/include/llvm/ProfileData/Coverage/CoverageMappingWriter.h
    M llvm/include/llvm/ProfileData/InstrProfData.inc
    M llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
    M llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
    A llvm/test/tools/llvm-cov/Inputs/binary-formats.v6.linux64l
    M llvm/test/tools/llvm-cov/binary-formats.c
    M llvm/unittests/ProfileData/CoverageMappingTest.cpp

  Log Message:
  -----------
  [Coverage] Store compilation dir separately in coverage mapping

We currently always store absolute filenames in coverage mapping.  This
is problematic for several reasons. It poses a problem for distributed
compilation as source location might vary across machines.  We are also
duplicating the path prefix potentially wasting space.

This change modifies how we store filenames in coverage mapping. Rather
than absolute paths, it stores the compilation directory and file paths
as given to the compiler, either relative or absolute. Later when
reading the coverage mapping information, we recombine relative paths
with the working directory. This approach is similar to handling
ofDW_AT_comp_dir in DWARF.

Finally, we also provide a new option, -fprofile-compilation-dir akin
to -fdebug-compilation-dir which can be used to manually override the
compilation directory which is useful in distributed compilation cases.

Differential Revision: https://reviews.llvm.org/D95753




More information about the All-commits mailing list