• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 The Chromium Authors
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/c++/c++.gni")
6import("//build/toolchain/rbe.gni")
7import("//build/toolchain/siso.gni")
8import("//build/toolchain/toolchain.gni")
9
10default_clang_base_path = "//third_party/llvm-build/Release+Asserts"
11
12declare_args() {
13  # Indicates if the build should use the Chrome-specific plugins for enforcing
14  # coding guidelines, etc. Only used when compiling with Chrome's Clang, not
15  # Chrome OS's.
16  clang_use_chrome_plugins =
17      is_clang && !is_nacl && current_os != "zos" &&
18      default_toolchain != "//build/toolchain/cros:target" &&
19      # TODO(https://crbug.com/351909443): Remove this after fixing performance
20      # of Clang modules build.
21      !use_libcxx_modules
22
23  # Use this instead of clang_use_chrome_plugins to enable just the raw-ptr-plugin.
24  clang_use_raw_ptr_plugin = false
25
26  enable_check_raw_ptr_fields =
27      build_with_chromium && !is_official_build &&
28      ((is_linux && !is_castos) || (is_android && !is_cast_android) || is_mac ||
29       is_ios || is_win || is_chromeos)
30
31  # TODO(crbug.com/40268473): Merge with enable_check_raw_ptr_fields once both
32  # checks are activated on the same set of platforms.
33  enable_check_raw_ref_fields =
34      build_with_chromium && !is_official_build &&
35      ((is_linux && !is_castos) || (is_android && !is_cast_android) || is_win ||
36       is_mac || is_ios || is_chromeos)
37
38  clang_base_path = default_clang_base_path
39
40  # Specifies whether or not bitcode should be embedded during compilation.
41  # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case.
42  clang_embed_bitcode = false
43
44  # Set to true to enable output of ThinLTO index and import files used for
45  # creating a Chromium MLGO corpus in the ThinLTO case.
46  lld_emit_indexes_and_imports = false
47}
48
49# We don't really need to collect a corpus for the host tools, just for the target.
50lld_emit_indexes_and_imports =
51    lld_emit_indexes_and_imports && is_a_target_toolchain
52
53# TODO(crbug.com/326584510): Reclient does not upload `inputs` from C/C++
54# targets. This file is added to `inputs` for all C targets in
55# //build/config/BUILDCONFIG.gn via //build/config/clang:unsafe_buffers.
56# We work around the bug in Reclient by specifying the file here.
57#
58# This is a comma-delimited list of paths relative to the source tree root. The
59# leading space is important, if the string is non-empty. :)
60rbe_bug_326584510_missing_inputs = ""
61if (clang_use_chrome_plugins && defined(clang_unsafe_buffers_paths) &&
62    "$clang_unsafe_buffers_paths" != "") {
63  if (rbe_exec_root != rebase_path("//")) {
64    assert(!use_siso, "Can't use non-default rbe_exec_root with siso.")
65  }
66  from_exec_root = rebase_path(clang_unsafe_buffers_paths, rbe_exec_root)
67  rbe_bug_326584510_missing_inputs = " -inputs=$from_exec_root"
68}
69