clang tooling: Make script arguments more consistent and update docs
- all: Use -p consistently to specify a path to the compile db to match
the convention of clang::tooling::ClangTool
- all: Default -p to out/Debug for convenience.
- docs: Update docs to reference renamed arguments
- docs: Update clang-tidy documentation to use the compile DB generation
wrapper script
- run_tool.py: Change tool to a non-positional argument and make it a
required argument.
Change-Id: I378402cab36e86da4b13fb43e26067cad4db1795
Reviewed-on: https://chromium-review.googlesource.com/494946
Commit-Queue: Daniel Cheng <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#469409}
diff --git a/docs/clang_tool_refactoring.md b/docs/clang_tool_refactoring.md
index 9fc3a7f..2911a1ab 100644
--- a/docs/clang_tool_refactoring.md
+++ b/docs/clang_tool_refactoring.md
@@ -128,9 +128,9 @@
Then run the actual clang tool to generate a list of edits:
```shell
-tools/clang/scripts/run_tool.py <toolname> \
+tools/clang/scripts/run_tool.py --tool <path to tool> \
--generate-compdb
- out/Debug <path 1> <path 2> ... >/tmp/list-of-edits.debug
+ -p out/Debug <path 1> <path 2> ... >/tmp/list-of-edits.debug
```
`--generate-compdb` can be omitted if the compile DB was already generated and
@@ -145,9 +145,9 @@
from `//base` that got included by source files in `//cc`).
```shell
-tools/clang/scripts/run_tool.py empty_string \
+tools/clang/scripts/run_tool.py --tool empty_string \
--generated-compdb \
- out/Debug net >/tmp/list-of-edits.debug
+ -p out/Debug net >/tmp/list-of-edits.debug
```
Note that some header files might only be included from generated files (e.g.
@@ -162,7 +162,7 @@
```shell
cat /tmp/list-of-edits.debug \
| tools/clang/scripts/extract_edits.py \
- | tools/clang/scripts/apply_edits.py out/Debug <path 1> <path 2> ...
+ | tools/clang/scripts/apply_edits.py -p out/Debug <path 1> <path 2> ...
```
The apply_edits.py tool will only apply edits to files actually under control of