1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46

build / config / clang / clang.gni [blame]

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//build/toolchain/toolchain.gni")

default_clang_base_path = "//third_party/llvm-build/Release+Asserts"

declare_args() {
  # Indicates if the build should use the Chrome-specific plugins for enforcing
  # coding guidelines, etc. Only used when compiling with Chrome's Clang, not
  # Chrome OS's.
  clang_use_chrome_plugins =
      is_clang && !is_nacl && current_os != "zos" &&
      default_toolchain != "//build/toolchain/cros:target"

  # Use this instead of clang_use_chrome_plugins to enable just the raw-ptr-plugin.
  clang_use_raw_ptr_plugin = false

  enable_check_raw_ptr_fields =
      build_with_chromium && !is_official_build &&
      ((is_linux && !is_castos) || (is_android && !is_cast_android) || is_mac ||
       is_ios || is_win || is_chromeos_lacros || is_chromeos_ash)

  # TODO(crbug.com/40268473): Merge with enable_check_raw_ptr_fields once both
  # checks are activated on the same set of platforms.
  enable_check_raw_ref_fields =
      build_with_chromium && !is_official_build &&
      ((is_linux && !is_castos) || (is_android && !is_cast_android) || is_win ||
       is_mac || is_ios || is_chromeos_lacros || is_chromeos_ash)

  clang_base_path = default_clang_base_path

  # Specifies whether or not bitcode should be embedded during compilation.
  # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case.
  clang_embed_bitcode = false

  # Set to true to enable output of ThinLTO index and import files used for
  # creating a Chromium MLGO corpus in the ThinLTO case.
  lld_emit_indexes_and_imports = false
}

# We don't really need to collect a corpus for the host tools, just for the target.
lld_emit_indexes_and_imports =
    lld_emit_indexes_and_imports && is_a_target_toolchain