This commit is contained in:
2024-09-27 19:16:49 +08:00
commit 49d0cea04d
10000 changed files with 1616312 additions and 0 deletions

38
build/config/coverage/BUILD.gn Executable file
View File

@@ -0,0 +1,38 @@
# 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 = [
"--coverage",
# 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 = [ "--coverage" ]
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.
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")
}
}
}
}

View File

@@ -0,0 +1,13 @@
# 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/toolchain/toolchain.gni")
declare_args() {
# Enable Clang's Source-based Code Coverage.
use_clang_coverage = false
}
assert(!use_clang_coverage || is_clang,
"Clang Source-based Code Coverage requires clang.")