15f9996aaSopenharmony_ci# Copyright 2017 The Chromium Authors. All rights reserved. 25f9996aaSopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 35f9996aaSopenharmony_ci# found in the LICENSE file. 45f9996aaSopenharmony_ci 55f9996aaSopenharmony_ciimport("//build/config/coverage/coverage.gni") 65f9996aaSopenharmony_ci 75f9996aaSopenharmony_ciconfig("default_coverage") { 85f9996aaSopenharmony_ci if (use_clang_coverage) { 95f9996aaSopenharmony_ci cflags = [ 105f9996aaSopenharmony_ci "--coverage", 115f9996aaSopenharmony_ci 125f9996aaSopenharmony_ci # Following experimental flags removes unused header functions from the 135f9996aaSopenharmony_ci # coverage mapping data embedded in the test binaries, and the reduction 145f9996aaSopenharmony_ci # of binary size enables building Chrome's large unit test targets on 155f9996aaSopenharmony_ci # MacOS. Please refer to crbug.com/796290 for more details. 165f9996aaSopenharmony_ci "-mllvm", 175f9996aaSopenharmony_ci "-limited-coverage-experimental=true", 185f9996aaSopenharmony_ci ] 195f9996aaSopenharmony_ci 205f9996aaSopenharmony_ci ldflags = [] 215f9996aaSopenharmony_ci if (!is_win) { 225f9996aaSopenharmony_ci ldflags = [ "--coverage" ] 235f9996aaSopenharmony_ci cflags += [ "-fno-use-cxa-atexit" ] 245f9996aaSopenharmony_ci } else { 255f9996aaSopenharmony_ci # Windows directly calls link.exe instead of the compiler driver when 265f9996aaSopenharmony_ci # linking. Hence, pass the runtime libraries instead of 275f9996aaSopenharmony_ci # -fsanitize=address. 285f9996aaSopenharmony_ci if (target_cpu == "x64") { 295f9996aaSopenharmony_ci ldflags += [ "clang_rt.profile-x86_64.lib" ] 305f9996aaSopenharmony_ci } else if (target_cpu == "x86") { 315f9996aaSopenharmony_ci ldflags += [ "clang_rt.profile-i386.lib" ] 325f9996aaSopenharmony_ci } else { 335f9996aaSopenharmony_ci assert(false, 345f9996aaSopenharmony_ci "use_clang_coverage=true not supported yet for this target_cpu") 355f9996aaSopenharmony_ci } 365f9996aaSopenharmony_ci } 375f9996aaSopenharmony_ci } 385f9996aaSopenharmony_ci} 39