[PATCH] D62508: gn build: Make it possible to build with coverage information
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 12:59:07 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362018: gn build: Make it possible to build with coverage information (authored by nico, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D62508?vs=201602&id=202028#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62508/new/
https://reviews.llvm.org/D62508
Files:
llvm/trunk/utils/gn/build/BUILD.gn
Index: llvm/trunk/utils/gn/build/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/build/BUILD.gn
+++ llvm/trunk/utils/gn/build/BUILD.gn
@@ -3,6 +3,19 @@
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/toolchain/target_flags.gni")
+declare_args() {
+ # Whether to build everything with coverage information.
+ # After building with this, run tests and then run
+ # llvm/utils/prepare-code-coverage-artifact.py \
+ # .../llvm-profdata .../llvm-cov out/gn/profiles/ report/ \
+ # out/gn/bin/llvm-undname ...`
+ # to generate a HTML report for the binaries passed in the last line.
+ llvm_build_instrumented_coverage = false
+}
+
+assert(!llvm_build_instrumented_coverage || is_clang,
+ "llvm_build_instrumented_coverage requires clang as host compiler")
+
config("compiler_defaults") {
defines = []
@@ -136,6 +149,21 @@
if (use_lld && host_os != "win") {
ldflags += [ "-fuse-ld=lld" ]
}
+
+ if (llvm_build_instrumented_coverage) {
+ cflags += [
+ "-fcoverage-mapping",
+
+ # Using an absolute path here is lame, but it's used at test execution
+ # time to generate the profiles, and lit doesn't specify a fixed folder
+ # for test execution -- so this is the only way to get all profiles into
+ # a single folder like llvm/utils/prepare-code-coverage-artifact.py
+ # expects.
+ "-fprofile-instr-generate=" +
+ rebase_path("$root_build_dir/profiles/%4m.profraw"),
+ ]
+ ldflags += [ "-fprofile-instr-generate" ]
+ }
}
config("no_exceptions") {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62508.202028.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190529/adffab8f/attachment.bin>
More information about the llvm-commits
mailing list