1# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/coverage/coverage.gni")
6
7config("default_coverage") {
8  if (use_clang_coverage) {
9    ldflags = []
10    if (!is_win) {
11      # Windows directly calls link.exe instead of the compiler driver when
12      # linking, and embeds the path to the profile runtime library as
13      # dependent library into each object file.
14      ldflags += [ "-fprofile-instr-generate" ]
15    }
16
17    cflags = [
18      "-fprofile-instr-generate",
19      "-fcoverage-mapping",
20
21      # Following experimental flags removes unused header functions from the
22      # coverage mapping data embedded in the test binaries, and the reduction
23      # of binary size enables building Chrome's large unit test targets on
24      # MacOS. Please refer to crbug.com/796290 for more details.
25      "-mllvm",
26      "-limited-coverage-experimental=true",
27    ]
28
29    if (!is_win) {
30      cflags += [ "-fno-use-cxa-atexit" ]
31    }
32  }
33}
34