| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 http://groups.google.com/a/chromium.org/group/clang/topics | 44 http://groups.google.com/a/chromium.org/group/clang/topics |
| 45 | 45 |
| 46 ## Using plugins | 46 ## Using plugins |
| 47 | 47 |
| 48 The | 48 The |
| 49 [chromium style plugin](http://dev.chromium.org/developers/coding-style/chromium
-style-checker-errors) | 49 [chromium style plugin](http://dev.chromium.org/developers/coding-style/chromium
-style-checker-errors) |
| 50 is used by default when clang is used. | 50 is used by default when clang is used. |
| 51 | 51 |
| 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.sh --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. Build with clang like described above. | 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 | 58 |
| 58 TODO: writing_clang_plugins does not exist. | 59 To test the FindBadConstructs plugin, run: |
| 60 |
| 61 (cd tools/clang/plugins/tests && \ |
| 62 ./test.sh ../../../../third_party/llvm-build/Release+Asserts/bin/clang \ |
| 63 ../../../../third_party/llvm-build/Release+Asserts/lib/libFindBad
Constructs.so) |
| 64 |
| 59 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 |
| 60 `GYP_DEFINES`: | 66 `GYP_DEFINES`: |
| 61 | 67 |
| 62 * `clang_load`: Absolute path to a dynamic library containing your plugin | 68 * `clang_load`: Absolute path to a dynamic library containing your plugin |
| 63 * `clang_add_plugin`: tells clang to run a specific PluginASTAction | 69 * `clang_add_plugin`: tells clang to run a specific PluginASTAction |
| 64 | 70 |
| 65 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: |
| 66 | 72 |
| 67 * `GYP_DEFINES='clang=1 clang_load=/path/to/libFindBadConstructs.so | 73 * `GYP_DEFINES='clang=1 clang_load=/path/to/libFindBadConstructs.so |
| 68 clang_add_plugin=find-bad-constructs' gclient runhooks` | 74 clang_add_plugin=find-bad-constructs' gclient runhooks` |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 124 |
| 119 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 |
| 120 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 |
| 121 -C out/Release` to build. | 127 -C out/Release` to build. |
| 122 | 128 |
| 123 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 |
| 124 | 130 |
| 125 * Check `tools/clang/scripts/update.sh` to find chromium's clang revision | 131 * Check `tools/clang/scripts/update.sh` to find chromium's clang revision |
| 126 * 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 |
| 127 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 |