1# Copyright 2013 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("clang.gni") 6 7config("find_bad_constructs") { 8 if (clang_use_chrome_plugins) { 9 cflags = [] 10 11 # The plugin is built directly into clang, so there's no need to load it 12 # dynamically. 13 cflags += [ 14 "-Xclang", 15 "-add-plugin", 16 "-Xclang", 17 "find-bad-constructs", 18 19 "-Xclang", 20 "-plugin-arg-find-bad-constructs", 21 "-Xclang", 22 "raw-ref-template-as-trivial-member", 23 24 "-Xclang", 25 "-plugin-arg-find-bad-constructs", 26 "-Xclang", 27 "check-stack-allocated", 28 ] 29 30 if (is_linux || is_chromeos || is_android || is_fuchsia) { 31 cflags += [ 32 "-Xclang", 33 "-plugin-arg-find-bad-constructs", 34 "-Xclang", 35 "check-ipc", 36 ] 37 } 38 39 if (enable_check_raw_ptr_fields) { 40 cflags += [ 41 "-Xclang", 42 "-plugin-arg-find-bad-constructs", 43 "-Xclang", 44 "check-raw-ptr-fields", 45 46 # TODO(keishi): Remove this once crrev.com/c/4387753 is rolled out. 47 "-Xclang", 48 "-plugin-arg-find-bad-constructs", 49 "-Xclang", 50 "raw-ptr-exclude-path=base/no_destructor.h", 51 52 # TODO(keishi): Remove this once crrev.com/c/4086161 lands. 53 "-Xclang", 54 "-plugin-arg-find-bad-constructs", 55 "-Xclang", 56 "raw-ptr-exclude-path=base/containers/span.h", 57 ] 58 } 59 } 60} 61 62# Enables some extra Clang-specific warnings. Some third-party code won't 63# compile with these so may want to remove this config. 64config("extra_warnings") { 65 cflags = [ 66 "-Wheader-hygiene", 67 68 # Warns when a const char[] is converted to bool. 69 "-Wstring-conversion", 70 71 "-Wtautological-overlap-compare", 72 ] 73} 74 75group("llvm-symbolizer_data") { 76 if (is_win) { 77 data = [ "$clang_base_path/bin/llvm-symbolizer.exe" ] 78 } else { 79 data = [ "$clang_base_path/bin/llvm-symbolizer" ] 80 } 81} 82