clang.gni (3167B)
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 5 import("//chromium/build/config/c++/c++.gni") 6 import("//chromium/build/toolchain/rbe.gni") 7 import("//chromium/build/toolchain/siso.gni") 8 import("//chromium/build/toolchain/toolchain.gni") 9 10 default_clang_base_path = "//third_party/llvm-build/Release+Asserts" 11 12 declare_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 != "//chromium/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. 50 lld_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. We work around the bug in Reclient by 55 # specifying the files here. 56 rbe_bug_326584510_missing_input_list = [] 57 if (clang_use_chrome_plugins && defined(clang_unsafe_buffers_paths) && 58 "$clang_unsafe_buffers_paths" != "") { 59 if (rbe_exec_root != rebase_path("//")) { 60 assert(!use_siso, "Can't use non-default rbe_exec_root with siso.") 61 } 62 rbe_bug_326584510_missing_input_list += 63 [ rebase_path(clang_unsafe_buffers_paths, rbe_exec_root) ] 64 } 65 if (defined(clang_warning_suppression_file) && 66 "$clang_warning_suppression_file" != "") { 67 if (rbe_exec_root != rebase_path("//")) { 68 assert(!use_siso, "Can't use non-default rbe_exec_root with siso.") 69 } 70 rbe_bug_326584510_missing_input_list += 71 [ rebase_path(clang_warning_suppression_file, rbe_exec_root) ] 72 } 73 74 # The leading space is important, if the string is non-empty. 75 rbe_bug_326584510_missing_inputs = 76 " -inputs=" + string_join(",", rbe_bug_326584510_missing_input_list)