OLD | NEW |
1 # Clang | 1 # Clang |
2 | 2 |
3 [Clang](http://clang.llvm.org/) is a compiler with many desirable features | 3 [Clang](http://clang.llvm.org/) is a compiler with many desirable features |
4 (outlined on their website). | 4 (outlined on their website). |
5 | 5 |
6 Chrome can be built with Clang. It is now the default compiler on Mac and Linux | 6 Chrome can be built with Clang. It is now the default compiler on Mac and Linux |
7 for building Chrome, and it is currently useful for its warning and error | 7 for building Chrome, and it is currently useful for its warning and error |
8 messages on Android and Windows. | 8 messages on Android and Windows. |
9 | 9 |
10 See | 10 See |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 If you're working on the plugin, you can build it locally like so: | 52 If you're working on the plugin, you can build it locally like so: |
53 | 53 |
54 1. Run `./tools/clang/scripts/update.py --force-local-build --without-android` | 54 1. Run `./tools/clang/scripts/update.py --force-local-build --without-android` |
55 to build the plugin. | 55 to build the plugin. |
56 1. Run `ninja -C third_party/llvm-build/Release+Asserts/` to build incrementall
y. | 56 1. Run `ninja -C third_party/llvm-build/Release+Asserts/` to build incrementall
y. |
57 1. Build with clang like described above, but, if you use goma, disable it. | 57 1. Build with clang like described above, but, if you use goma, disable it. |
58 | 58 |
59 To test the FindBadConstructs plugin, run: | 59 To test the FindBadConstructs plugin, run: |
60 | 60 |
61 (cd tools/clang/plugins/tests && \ | 61 (cd tools/clang/plugins/tests && \ |
62 ./test.sh ../../../../third_party/llvm-build/Release+Asserts/bin/clang \ | 62 ./test.py ../../../../third_party/llvm-build/Release+Asserts/bin/clang \ |
63 ../../../../third_party/llvm-build/Release+Asserts/lib/libFindBad
Constructs.so) | 63 ../../../../third_party/llvm-build/Release+Asserts/lib/libFindBad
Constructs.so) |
64 | 64 |
65 To run [other plugins](writing_clang_plugins.md), add these to your | 65 To run [other plugins](writing_clang_plugins.md), add these to your |
66 `GYP_DEFINES`: | 66 `GYP_DEFINES`: |
67 | 67 |
68 * `clang_load`: Absolute path to a dynamic library containing your plugin | 68 * `clang_load`: Absolute path to a dynamic library containing your plugin |
69 * `clang_add_plugin`: tells clang to run a specific PluginASTAction | 69 * `clang_add_plugin`: tells clang to run a specific PluginASTAction |
70 | 70 |
71 So for example, you could use the plugin in this directory with: | 71 So for example, you could use the plugin in this directory with: |
72 | 72 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 You can then run `head out/Release/build.ninja` and check that the first to | 125 You can then run `head out/Release/build.ninja` and check that the first to |
126 lines set `cc` and `cxx` to your clang binary. If things look good, run `ninja | 126 lines set `cc` and `cxx` to your clang binary. If things look good, run `ninja |
127 -C out/Release` to build. | 127 -C out/Release` to build. |
128 | 128 |
129 If your clang revision is very different from the one currently used in chromium | 129 If your clang revision is very different from the one currently used in chromium |
130 | 130 |
131 * Check `tools/clang/scripts/update.py` to find chromium's clang revision | 131 * Check `tools/clang/scripts/update.py` to find chromium's clang revision |
132 * You might have to tweak warning flags. Or you could set `werror=` in the | 132 * You might have to tweak warning flags. Or you could set `werror=` in the |
133 line above to disable warnings as errors (but this only works on Linux). | 133 line above to disable warnings as errors (but this only works on Linux). |
OLD | NEW |