OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/clang/clang.gni") | 6 import("//build/config/clang/clang.gni") |
7 import("//build/config/nacl/config.gni") | 7 import("//build/config/nacl/config.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/config/v8_target_cpu.gni") | 9 import("//build/config/v8_target_cpu.gni") |
10 import("//build/toolchain/cc_wrapper.gni") | 10 import("//build/toolchain/cc_wrapper.gni") |
| 11 import("//build/toolchain/clang_static_analyzer.gni") |
11 import("//build/toolchain/goma.gni") | 12 import("//build/toolchain/goma.gni") |
12 import("//build/toolchain/toolchain.gni") | 13 import("//build/toolchain/toolchain.gni") |
13 | 14 |
14 # This template defines a toolchain for something that works like gcc | 15 # This template defines a toolchain for something that works like gcc |
15 # (including clang). | 16 # (including clang). |
16 # | 17 # |
17 # It requires the following variables specifying the executables to run: | 18 # It requires the following variables specifying the executables to run: |
18 # - ar | 19 # - ar |
19 # - cc | 20 # - cc |
20 # - cxx | 21 # - cxx |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } else { | 481 } else { |
481 toolprefix = "" | 482 toolprefix = "" |
482 } | 483 } |
483 | 484 |
484 gcc_toolchain(target_name) { | 485 gcc_toolchain(target_name) { |
485 prefix = rebase_path("$clang_base_path/bin", root_build_dir) | 486 prefix = rebase_path("$clang_base_path/bin", root_build_dir) |
486 cc = "$prefix/clang" | 487 cc = "$prefix/clang" |
487 cxx = "$prefix/clang++" | 488 cxx = "$prefix/clang++" |
488 ld = cxx | 489 ld = cxx |
489 | 490 |
| 491 if (use_clang_static_analyzer) { |
| 492 # Call "ccc-analyzer" or "c++-analyzer" instead of directly calling Clang. |
| 493 # |wrapper_tool| sets the environment variables which are read by the |
| 494 # analyzer tools. |
| 495 analyzer_wrapper = |
| 496 rebase_path("//build/toolchain/clang_static_analyzer_wrapper.py", |
| 497 root_build_dir) |
| 498 cc = analyzer_wrapper + " --clang-cc-path=${cc} --analyzer=" + |
| 499 rebase_path("//third_party/scan-build/src/libexec/ccc-analyzer", |
| 500 root_build_dir) |
| 501 cxx = analyzer_wrapper + " --clang-cxx-path=${cxx} --analyzer=" + |
| 502 rebase_path("//third_party/scan-build/src/libexec/c++-analyzer", |
| 503 root_build_dir) |
| 504 } |
| 505 |
490 readelf = "${toolprefix}readelf" | 506 readelf = "${toolprefix}readelf" |
491 ar = "${toolprefix}ar" | 507 ar = "${toolprefix}ar" |
492 nm = "${toolprefix}nm" | 508 nm = "${toolprefix}nm" |
493 | 509 |
494 forward_variables_from(invoker, [ "strip" ]) | 510 forward_variables_from(invoker, [ "strip" ]) |
495 | 511 |
496 toolchain_args = { | 512 toolchain_args = { |
497 if (defined(invoker.toolchain_args)) { | 513 if (defined(invoker.toolchain_args)) { |
498 forward_variables_from(invoker.toolchain_args, "*") | 514 forward_variables_from(invoker.toolchain_args, "*") |
499 } | 515 } |
500 is_clang = true | 516 is_clang = true |
501 } | 517 } |
502 } | 518 } |
503 } | 519 } |
OLD | NEW |