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

Side by Side Diff: docs/clang_tool_refactoring.md

Issue 1489223003: Remove stray references to update.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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 | « docs/clang_static_analyzer.md ('k') | docs/updating_clang.md » ('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 ## Caveats 5 ## Caveats
6 6
7 * The current workflow requires git. 7 * The current workflow requires git.
8 * This doesn't work on Windows... yet. I'm hoping to have a proof-of-concept 8 * This doesn't work on Windows... yet. I'm hoping to have a proof-of-concept
9 working on Windows as well ~~in a month~~ several centuries from now. 9 working on Windows as well ~~in a month~~ several centuries from now.
10 10
11 ## Prerequisites 11 ## Prerequisites
12 12
13 Everything needed should be in a default Chromium checkout using gclient. 13 Everything needed should be in a default Chromium checkout using gclient.
14 `third_party/llvm-build/Release+Asserts/bin` should be in your `$PATH`. 14 `third_party/llvm-build/Release+Asserts/bin` should be in your `$PATH`.
15 15
16 ## Writing the Tool 16 ## Writing the Tool
17 17
18 An example clang tool is being implemented in 18 An example clang tool is being implemented in
19 https://codereview.chromium.org/12746010/. Other useful resources might be the 19 https://codereview.chromium.org/12746010/. Other useful resources might be the
20 [basic tutorial for Clang's AST matchers](http://clang.llvm.org/docs/LibASTMatch ersTutorial.html) 20 [basic tutorial for Clang's AST matchers](http://clang.llvm.org/docs/LibASTMatch ersTutorial.html)
21 or the 21 or the
22 [AST matcher reference](http://clang.llvm.org/docs/LibASTMatchersReference.html) . 22 [AST matcher reference](http://clang.llvm.org/docs/LibASTMatchersReference.html) .
23 23
24 Build your tool by running the following command (requires cmake version 2.8.10 24 Build your tool by running the following command (requires cmake version 2.8.10
25 or later): 25 or later):
26 26
27 ```shell 27 ```shell
28 tools/clang/scripts/update.sh --force-local-build --without-android \ 28 tools/clang/scripts/update.py --force-local-build --without-android \
29 --with-chrome-tools <tools> 29 --with-chrome-tools <tools>
30 ``` 30 ```
31 31
32 `<tools>` is a semicolon delimited list of subdirectories in `tools/clang` to 32 `<tools>` is a semicolon delimited list of subdirectories in `tools/clang` to
33 build. The resulting binary will end up in 33 build. The resulting binary will end up in
34 `third_party/llvm-build/Release+Asserts/bin`. For example, to build the Chrome 34 `third_party/llvm-build/Release+Asserts/bin`. For example, to build the Chrome
35 plugin and the empty\_string tool, run the following: 35 plugin and the empty\_string tool, run the following:
36 36
37 ```shell 37 ```shell
38 tools/clang/scripts/update.sh --force-local-build --without-android \ 38 tools/clang/scripts/update.py --force-local-build --without-android \
39 --with-chrome-tools "plugins;empty_string" 39 --with-chrome-tools "plugins;empty_string"
40 ``` 40 ```
41 41
42 When writing AST matchers, the following can be helpful to see what clang thinks 42 When writing AST matchers, the following can be helpful to see what clang thinks
43 the AST is: 43 the AST is:
44 44
45 ```shell 45 ```shell
46 clang++ -cc1 -ast-dump foo.cc 46 clang++ -cc1 -ast-dump foo.cc
47 ``` 47 ```
48 48
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 ```shell 92 ```shell
93 test_tool.py <tool name> 93 test_tool.py <tool name>
94 ``` 94 ```
95 95
96 Note that name of the built tool and the subdirectory it lives in at 96 Note that name of the built tool and the subdirectory it lives in at
97 `tools/clang` must match. What the test harness does is find all files that 97 `tools/clang` must match. What the test harness does is find all files that
98 match the pattern `*-original.cc` in your tool's tests subdirectory. It then 98 match the pattern `*-original.cc` in your tool's tests subdirectory. It then
99 runs the tool across those files and compares it to the expected result, stored 99 runs the tool across those files and compares it to the expected result, stored
100 in `*-expected.cc` 100 in `*-expected.cc`
OLDNEW
« no previous file with comments | « docs/clang_static_analyzer.md ('k') | docs/updating_clang.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698