Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: docs/clang_tool_refactoring.md

Issue 2919243002: Add a clang tool to detect std::move(raw ptr) (Closed)
Patch Set: Add a TODO to make this a clang-tidy check Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/clang/move_raw/CMakeLists.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 `--extra-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
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 109
110 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)
111 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.
112 112
113 Once clang is bootsrapped, incremental builds can be done by invoking `ninja` in
114 the `third_party/llvm-build/Release+Asserts` directory. In particular,
115 recompiling solely the tool you are writing can be accomplished by executing
116 `ninja rewrite_to_chrome_style` (replace `rewrite_to_chrome_style` with your
117 tool's name).
118
113 ## Running 119 ## Running
114 First, build all Chromium targets to avoid failures due to missing dependencies 120 First, build all Chromium targets to avoid failures due to missing dependencies
115 that are generated as part of the build: 121 that are generated as part of the build:
116 122
117 ```shell 123 ```shell
118 ninja -C out/Debug # For non-Windows 124 ninja -C out/Debug # For non-Windows
119 ninja -d keeprsp -C out/Debug # For Windows 125 ninja -d keeprsp -C out/Debug # For Windows
120 126
121 # experimental alternative: 127 # experimental alternative:
122 $gen_targets = $(ninja -C out/gn -t targets all \ 128 $gen_targets = $(ninja -C out/gn -t targets all \
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 209
204 ```shell 210 ```shell
205 tools/clang/scripts/test_tool.py <tool name> 211 tools/clang/scripts/test_tool.py <tool name>
206 ``` 212 ```
207 213
208 The name of the tool binary and the subdirectory for the tool in 214 The name of the tool binary and the subdirectory for the tool in
209 `//tools/clang` must match. The test runner finds all files that match the 215 `//tools/clang` must match. The test runner finds all files that match the
210 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across 216 pattern `//tools/clang/<tool name>/tests/*-original.cc`, runs the tool across
211 those files, and compared it to the `*-expected.cc` version. If there is a 217 those files, and compared it to the `*-expected.cc` version. If there is a
212 mismatch, the result is saved in `*-actual.cc`. 218 mismatch, the result is saved in `*-actual.cc`.
OLDNEW
« no previous file with comments | « no previous file | tools/clang/move_raw/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698