naiveproxy/build/config/coverage/BUILD.gn
2018-12-09 21:59:24 -05:00

42 lines
1.4 KiB
Plaintext

# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/coverage/coverage.gni")
config("default_coverage") {
if (use_clang_coverage) {
cflags = [
"-fprofile-instr-generate",
"-fcoverage-mapping",
# Following experimental flags removes unused header functions from the
# coverage mapping data embedded in the test binaries, and the reduction
# of binary size enables building Chrome's large unit test targets on
# MacOS. Please refer to crbug.com/796290 for more details.
"-mllvm",
"-limited-coverage-experimental=true",
]
ldflags = []
if (!is_win) {
ldflags += [ "-fprofile-instr-generate" ]
cflags += [ "-fno-use-cxa-atexit" ]
} else {
# Windows directly calls link.exe instead of the compiler driver when
# linking. Hence, pass the runtime libraries instead of
# -fsanitize=address.
# TODO(rnk): Come up with a more uniform approach for linking against
# compiler-rt for sanitizers and coverage.
if (target_cpu == "x64") {
ldflags += [ "clang_rt.profile-x86_64.lib" ]
} else if (target_cpu == "x86") {
ldflags += [ "clang_rt.profile-i386.lib" ]
} else {
assert(false &&
"use_clang_coverage=true not supported yet for this target_cpu")
}
}
}
}