Chromium Code Reviews| Index: docs/clang.md |
| diff --git a/docs/clang.md b/docs/clang.md |
| index a63ecdb86efe8582e12a42f07529d37b35b38878..3fbaf4659f420fad16b899e72ec0aa3d7e1e25a1 100644 |
| --- a/docs/clang.md |
| +++ b/docs/clang.md |
| @@ -26,7 +26,7 @@ Clang is the default compiler. |
| Run `gn args` and add `is_clang = true` to your args.gn file. |
| -Build: `ninja -C out/Debug chrome` |
| +Build: `ninja -C out/gn chrome` |
| ## Reverting to gcc on linux |
| @@ -57,19 +57,6 @@ To test the FindBadConstructs plugin, run: |
| ./test.py ../../../../third_party/llvm-build/Release+Asserts/bin/clang \ |
| ../../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so) |
| -These instructions are for GYP which no longer works. Something similar needs |
| -to be set up for the GN build if you want to do this. For reference, here are |
| -the old instructions: To run [other plugins](writing_clang_plugins.md), add |
| -these to your `GYP_DEFINES`: |
| - |
| -* `clang_load`: Absolute path to a dynamic library containing your plugin |
| -* `clang_add_plugin`: tells clang to run a specific PluginASTAction |
| - |
| -So for example, you could use the plugin in this directory with: |
| - |
| -* `GYP_DEFINES='clang=1 clang_load=/path/to/libFindBadConstructs.so |
| - clang_add_plugin=find-bad-constructs' gclient runhooks` |
| - |
| ## Using the clang static analyzer |
| See [clang_static_analyzer.md](clang_static_analyzer.md). |
| @@ -83,10 +70,10 @@ Things should compile, and all tests should pass. You can check these bots for |
| how things are currently looking: |
| http://build.chromium.org/p/chromium.fyi/console?category=win%20clang |
| -``` shell |
| +```shell |
| python tools\clang\scripts\update.py |
| # run `gn args` and add `is_clang = true` to your args.gn, then... |
| -ninja -C out\Debug chrome |
| +ninja -C out\gn chrome |
| ``` |
| The `update.py` script only needs to be run once per checkout. Clang will be |
| @@ -102,37 +89,30 @@ Current brokenness: |
| ## Using a custom clang binary |
| -These instructions are for GYP which no longer works. Something similar needs |
| -to be set up for the GN build if you want to do this. For reference, here are |
| -the old instructions: |
| - |
| -If you want to try building Chromium with your own clang binary that you've |
| -already built, set `make_clang_dir` to the directory containing `bin/clang` |
| -(i.e. the directory you ran cmake in, or your `Release+Asserts` folder if you |
| -use the configure/make build). You also need to disable chromium's clang plugin |
| -by setting `clang_use_chrome_plugins=0`, as it likely won't load in your custom |
| -clang binary. |
| +Set `clang_base_path` in your args.gn to the llvm build directory containing |
| +`bin/clang` (i.e. the directory you ran cmake). This [must][1] be an absolute |
| +path. You also need to disable chromium's clang plugin. |
| Here's an example that also disables debug info and enables the component build |
| (both not strictly necessary, but they will speed up your build): |
| -```shell |
| -GYP_DEFINES="clang=1 fastbuild=1 component=shared_library \ |
| -clang_use_chrome_plugins=0 make_clang_dir=$HOME/src/llvm-build" \ |
| -build/gyp_chromium |
| +``` |
| +clang_base_path = getenv("HOME") + "/src/llvm-build" |
| +clang_use_chrome_plugins = false |
| +is_debug = false |
| +symbol_level = 1 |
| +is_component_build = true |
| +is_clang = true # Implicitly set on Mac, Linux, iOS; needed on Win and Android. |
| ``` |
| -You can then run `head out/Release/build.ninja` and check that the first to |
| +You can then run `head out/gn/toolchain.ninja` and check that the first to |
| lines set `cc` and `cxx` to your clang binary. If things look good, run `ninja |
| --C out/Release` to build. |
| +-C out/gn` to build. |
| If your clang revision is very different from the one currently used in chromium |
| * Check `tools/clang/scripts/update.py` to find chromium's clang revision |
| -* You might have to tweak warning flags. Or you could set `werror=` in the |
| - line above to disable warnings as errors (but this only works on Linux). |
| - |
| -## Using LLD |
| +* You might have to tweak warning flags.## Using LLD |
|
hans
2016/11/29 20:55:57
missing newline before ## Using LLD here?
Nico
2016/11/29 20:57:35
Done.
|
| **Experimental!** |
| @@ -141,5 +121,5 @@ Linux support, where it can link Chrome approximately twice as fast as gold and |
| MSVC's link.exe as of this writing. LLD does not yet support generating PDB |
| files, which makes it hard to debug Chrome while using LLD. |
| -Set `use_lld = true` in args.gn. Currently this configuration is only supported |
| on Windows. |
| +Set `use_lld = true` in args.gn. |