[PATCH] D83154: clang: Add -fcoverage-prefix-map

Keith Smiley via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 17:27:34 PDT 2020


keith added inline comments.


================
Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:1334
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
----------------
rnk wrote:
> Please only make the path absolute if nothing in the prefix map matches. Otherwise, the user must embed the CWD into the prefix map, which is needlessly difficult for the build system. I believe it is also consistent with the way that the debug info prefix map works. It appears to operate on the possibly relative source paths received on the command line (-I...).
Are you suggesting that I try to remap them relatively, and if that fails, absolutize it and attempt the remapping again? Or don't absolutize them at all anymore?


================
Comment at: clang/test/Profile/profile-prefix-map.c:12
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s --implicit-check-not=root
+//
----------------
rnk wrote:
> See here, for example, where you must pass `-fprofile-prefix-map=%/t/...`.
+1. I do think I still want this test case, but likely another pending the discussion above that validates the relative path behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154



More information about the cfe-commits mailing list