Skip to content

Commit

Permalink
docs: Fix links/shell with whitespace changes.
Browse files Browse the repository at this point in the history
Links shouldn't have whitespace inside them, shell snippets
need whitespace around them.

R=dcheng

Review URL: https://codereview.chromium.org/1592883002

Cr-Commit-Position: refs/heads/master@{#369894}
  • Loading branch information
danakj authored and Commit bot committed Jan 16, 2016
1 parent f402ac5 commit ef9f1fa
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions docs/clang_tool_refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ writing a new tool.

Chromium clang tools generally follow this pattern:

1. Instantiate a [`clang::ast_matchers::MatchFinder`](
http://clang.llvm.org/doxygen/classclang_1_1ast__matchers_1_1MatchFinder.html).
2. Call `addMatcher()` to register [`clang::ast_matchers::MatchFinder::MatchCallback`](
http://clang.llvm.org/doxygen/classclang_1_1ast__matchers_1_1MatchFinder_1_1MatchCallback.html) actions to execute when [matching](http://clang.llvm.org/docs/LibASTMatchersReference.html) the AST.
1. Instantiate a [`clang::ast_matchers::MatchFinder`](http://clang.llvm.org/doxygen/classclang_1_1ast__matchers_1_1MatchFinder.html).
2. Call `addMatcher()` to register [`clang::ast_matchers::MatchFinder::MatchCallback`](http://clang.llvm.org/doxygen/classclang_1_1ast__matchers_1_1MatchFinder_1_1MatchCallback.html)
actions to execute when [matching](http://clang.llvm.org/docs/LibASTMatchersReference.html)
the AST.
3. Create a new `clang::tooling::FrontendActionFactory` from the `MatchFinder`.
4. Run the action across the specified files with
[`clang::tooling::ClangTool::run`](http://clang.llvm.org/doxygen/classclang_1_1tooling_1_1ClangTool.html#acec91f63b45ac7ee2d6c94cb9c10dab3).
5. Serialize generated [`clang::tooling::Replacement`](
http://clang.llvm.org/doxygen/classclang_1_1tooling_1_1Replacement.html)s to
`stdout`.
5. Serialize generated [`clang::tooling::Replacement`](http://clang.llvm.org/doxygen/classclang_1_1tooling_1_1Replacement.html)s
to `stdout`.

Other useful references when writing the tool:

Expand Down Expand Up @@ -85,10 +84,9 @@ TODO: Document more about `SourceLocation` and how spelling loc differs from
expansion loc, etc.

### Why not RefactoringTool?
While clang has a [`clang::tooling::RefactoringTool`](
http://clang.llvm.org/doxygen/classclang_1_1tooling_1_1RefactoringTool.html) to
automatically apply the generated replacements and save the results, it doesn't
work well for Chromium:
While clang has a [`clang::tooling::RefactoringTool`](http://clang.llvm.org/doxygen/classclang_1_1tooling_1_1RefactoringTool.html)
to automatically apply the generated replacements and save the results, it
doesn't work well for Chromium:

* Clang tools run actions serially, so runtime scales poorly to tens of
thousands of files.
Expand All @@ -97,10 +95,12 @@ work well for Chromium:

## Building
Synopsis:

```shell
tools/clang/scripts/update.py --force-local-build --without-android \
--tools blink_gc_plugin plugins rewrite_to_chrome_style
```

Running this command builds the [Oilpan plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/blink_gc_plugin/),
the [Chrome style
plugin](https://chromium.googlesource.com/chromium/src/+/master/tools/clang/plugins/),
Expand All @@ -112,6 +112,7 @@ Generally, `--tools` should always include `blink_gc_plugin` and `plugins`: othe
## Running
First, build all chromium targets to avoid failures due to missing dependecies
that are generated as part of the build:

```shell
ninja -C out/Debug
```
Expand Down

0 comments on commit ef9f1fa

Please sign in to comment.