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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 stmt->dumpColor(); | 165 stmt->dumpColor(); |
166 ``` | 166 ``` |
167 | 167 |
168 By default, the script hides the output of the tool. The easiest way to change | 168 By default, the script hides the output of the tool. The easiest way to change |
169 that is to `return 1` from the `main()` function of the clang tool. | 169 that is to `return 1` from the `main()` function of the clang tool. |
170 | 170 |
171 ## Testing | 171 ## Testing |
172 Synposis: | 172 Synposis: |
173 | 173 |
174 ```shell | 174 ```shell |
175 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 |