• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    cflags = [
10      "--coverage",
11
12      # Following experimental flags removes unused header functions from the
13      # coverage mapping data embedded in the test binaries, and the reduction
14      # of binary size enables building Chrome's large unit test targets on
15      # MacOS. Please refer to crbug.com/796290 for more details.
16      "-mllvm",
17      "-limited-coverage-experimental=true",
18    ]
19
20    ldflags = []
21    if (!is_win) {
22      ldflags = [ "--coverage" ]
23      cflags += [ "-fno-use-cxa-atexit" ]
24    } else {
25      # Windows directly calls link.exe instead of the compiler driver when
26      # linking.  Hence, pass the runtime libraries instead of
27      # -fsanitize=address.
28      if (target_cpu == "x64") {
29        ldflags += [ "clang_rt.profile-x86_64.lib" ]
30      } else if (target_cpu == "x86") {
31        ldflags += [ "clang_rt.profile-i386.lib" ]
32      } else {
33        assert(false,
34               "use_clang_coverage=true not supported yet for this target_cpu")
35      }
36    }
37  }
38}
39