[PATCH] D83154: clang: Add -fcoverage-prefix-map
Reid "Away June-Sep" Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 11:16:07 PDT 2020
rnk added inline comments.
================
Comment at: clang/include/clang/Driver/Options.td:1980
HelpText<"remap file source paths in debug info">;
+def fprofile_prefix_map_QA
+ : Joined<["-"], "fprofile-prefix-map=">, Group<f_Group>,
----------------
Any reason for the _QA suffix instead of _EQ?
================
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);
----------------
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...).
================
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
+//
----------------
See here, for example, where you must pass `-fprofile-prefix-map=%/t/...`.
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