OLD | NEW |
---|---|
1 # Clang Tool Refactoring | 1 # Clang Tool Refactoring |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Introduction | 5 ## Introduction |
6 | 6 |
7 Clang tools can help with global refactorings of Chromium code. Clang tools can | 7 Clang tools can help with global refactorings of Chromium code. Clang tools can |
8 take advantage of clang's AST to perform refactorings that would be impossible | 8 take advantage of clang's AST to perform refactorings that would be impossible |
9 with a traditional find-and-replace regexp: | 9 with a traditional find-and-replace regexp: |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 * Clang tools run actions serially, so runtime scales poorly to tens of | 90 * Clang tools run actions serially, so runtime scales poorly to tens of |
91 thousands of files. | 91 thousands of files. |
92 * A parsing error in any file (quite common in NaCl source) prevents any of | 92 * A parsing error in any file (quite common in NaCl source) prevents any of |
93 the generated replacements from being applied. | 93 the generated replacements from being applied. |
94 | 94 |
95 ## Building | 95 ## Building |
96 Synopsis: | 96 Synopsis: |
97 | 97 |
98 ```shell | 98 ```shell |
99 tools/clang/scripts/update.py --bootstrap --force-local-build --without-android \ | 99 tools/clang/scripts/update.py --bootstrap --force-local-build --without-android \ |
100 --tools blink_gc_plugin plugins rewrite_to_chrome_style | 100 --extra-tools rewrite_to_chrome_style |
101 ``` | 101 ``` |
102 | 102 |
103 Running this command builds the [Oilpan plugin](https://chromium.googlesource.co m/chromium/src/+/master/tools/clang/blink_gc_plugin/), | 103 Running this command builds the [Oilpan plugin](https://chromium.googlesource.co m/chromium/src/+/master/tools/clang/blink_gc_plugin/), |
104 the [Chrome style | 104 the [Chrome style |
105 plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/plug ins/), | 105 plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/plug ins/), |
106 and the [Blink to Chrome style rewriter](https://chromium.googlesource.com/chrom ium/src/+/master/tools/clang/rewrite_to_chrome_style/). Additional arguments to `--tools` should be the name of | 106 and the [Blink to Chrome style rewriter](https://chromium.googlesource.com/chrom ium/src/+/master/tools/clang/rewrite_to_chrome_style/). Additional arguments to `--extra-tools` should be the name of |
Łukasz Anforowicz
2016/12/30 17:19:01
nit: wrap this to 80 columns?
dcheng
2017/01/01 03:06:52
I'll try this in a followup: wrapping links is alw
| |
107 subdirectories in | 107 subdirectories in |
108 [//tools/clang](https://chromium.googlesource.com/chromium/src/+/master/tools/cl ang). | 108 [//tools/clang](https://chromium.googlesource.com/chromium/src/+/master/tools/cl ang). |
109 Generally, `--tools` should always include `blink_gc_plugin` and `plugins`: othe rwise, Chromium won't build. | |
110 | 109 |
111 It is important to use --bootstrap as there appear to be [bugs](https://crbug.co m/580745) | 110 It is important to use --bootstrap as there appear to be [bugs](https://crbug.co m/580745) |
112 in the clang library this script produces if you build it with gcc, which is the default. | 111 in the clang library this script produces if you build it with gcc, which is the default. |
113 | 112 |
114 ## Running | 113 ## Running |
115 First, build all Chromium targets to avoid failures due to missing dependencies | 114 First, build all Chromium targets to avoid failures due to missing dependencies |
116 that are generated as part of the build: | 115 that are generated as part of the build: |
117 | 116 |
118 ```shell | 117 ```shell |
119 ninja -C out/Debug # For non-Windows | 118 ninja -C out/Debug # For non-Windows |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 | 210 |
212 ```shell | 211 ```shell |
213 tools/clang/scripts/test_tool.py <tool name> | 212 tools/clang/scripts/test_tool.py <tool name> |
214 ``` | 213 ``` |
215 | 214 |
216 The name of the tool binary and the subdirectory for the tool in | 215 The name of the tool binary and the subdirectory for the tool in |
217 `//tools/clang` must match. The test runner finds all files that match the | 216 `//tools/clang` must match. The test runner finds all files that match the |
218 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across | 217 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across |
219 those files, and compared it to the `*-expected.cc` version. If there is a | 218 those files, and compared it to the `*-expected.cc` version. If there is a |
220 mismatch, the result is saved in `*-actual.cc`. | 219 mismatch, the result is saved in `*-actual.cc`. |
OLD | NEW |