| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/plug
ins/), | 106 plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/plug
ins/), |
| 107 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 | 107 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 |
| 108 subdirectories in | 108 subdirectories in |
| 109 [//tools/clang](https://chromium.googlesource.com/chromium/src/+/master/tools/cl
ang). | 109 [//tools/clang](https://chromium.googlesource.com/chromium/src/+/master/tools/cl
ang). |
| 110 Generally, `--tools` should always include `blink_gc_plugin` and `plugins`: othe
rwise, Chromium won't build. | 110 Generally, `--tools` should always include `blink_gc_plugin` and `plugins`: othe
rwise, Chromium won't build. |
| 111 | 111 |
| 112 It is important to use --bootstrap as there appear to be [bugs](https://crbug.co
m/580745) | 112 It is important to use --bootstrap as there appear to be [bugs](https://crbug.co
m/580745) |
| 113 in the clang library this script produces if you build it with gcc, which is the
default. | 113 in the clang library this script produces if you build it with gcc, which is the
default. |
| 114 | 114 |
| 115 ## Running | 115 ## Running |
| 116 First, build all chromium targets to avoid failures due to missing dependecies | 116 First, build all Chromium targets to avoid failures due to missing dependencies |
| 117 that are generated as part of the build: | 117 that are generated as part of the build: |
| 118 | 118 |
| 119 ```shell | 119 ```shell |
| 120 ninja -C out/Debug | 120 ninja -C out/Debug |
| 121 ``` | 121 ``` |
| 122 | 122 |
| 123 Then run the actual tool: | 123 Then run the actual tool: |
| 124 | 124 |
| 125 ```shell | 125 ```shell |
| 126 tools/clang/scripts/run_tool.py <toolname> \ | 126 tools/clang/scripts/run_tool.py <toolname> \ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 ```shell | 174 ```shell |
| 175 tools/clang/scripts/test_tool.py <tool name> | 175 tools/clang/scripts/test_tool.py <tool name> |
| 176 ``` | 176 ``` |
| 177 | 177 |
| 178 The name of the tool binary and the subdirectory for the tool in | 178 The name of the tool binary and the subdirectory for the tool in |
| 179 `//tools/clang` must match. The test runner finds all files that match the | 179 `//tools/clang` must match. The test runner finds all files that match the |
| 180 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across | 180 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across |
| 181 those files, and compared it to the `*-expected.cc` version. If there is a | 181 those files, and compared it to the `*-expected.cc` version. If there is a |
| 182 mismatch, the result is saved in `*-actual.cc`. | 182 mismatch, the result is saved in `*-actual.cc`. |
| OLD | NEW |