Commit 2800dd85 authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Print dumped json in generate_compdb.py

print shows u prefix in string (e.g u"directory").

I also updated clang_tidy docs to change directory for compile_commands.json.

Change-Id: I5e801519e7856feab2d32ac1ec6062687f0156b0
Reviewed-on: https://chromium-review.googlesource.com/1025491
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553041}
parent 706f8725
...@@ -53,7 +53,7 @@ ninja -C out/Release chrome ...@@ -53,7 +53,7 @@ ninja -C out/Release chrome
``` ```
2. Generate the compilation database 2. Generate the compilation database
``` ```
tools/clang/scripts/generate_compdb.py -p out/Release > compile_commands.json tools/clang/scripts/generate_compdb.py -p out/Release > out/Release/compile_commands.json
``` ```
3. Enter the build directory. 3. Enter the build directory.
``` ```
...@@ -62,7 +62,7 @@ cd out/Release ...@@ -62,7 +62,7 @@ cd out/Release
4. Run clang-tidy. 4. Run clang-tidy.
``` ```
<PATH_TO_LLVM_SRC>/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ <PATH_TO_LLVM_SRC>/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
-p ../.. \# Set the root project directory, where compile_commands.json is. -p . \# Set the root project directory, where compile_commands.json is.
# Set the clang-tidy binary path, if it's not in your $PATH. # Set the clang-tidy binary path, if it's not in your $PATH.
-clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \ -clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \
# Set the clang-apply-replacements binary path, if it's not in your $PATH # Set the clang-apply-replacements binary path, if it's not in your $PATH
...@@ -77,7 +77,7 @@ cd out/Release ...@@ -77,7 +77,7 @@ cd out/Release
Copy-Paste Friendly (though you'll still need to stub in the variables): Copy-Paste Friendly (though you'll still need to stub in the variables):
<PATH_TO_LLVM_SRC>/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ <PATH_TO_LLVM_SRC>/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
-p ../.. \ -p . \
-clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \ -clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \
-clang-apply-replacements-binary \ -clang-apply-replacements-binary \
<PATH_TO_LLVM_BUILD>/bin/clang-apply-replacements \ <PATH_TO_LLVM_BUILD>/bin/clang-apply-replacements \
......
...@@ -11,6 +11,7 @@ mode, etc. ...@@ -11,6 +11,7 @@ mode, etc.
""" """
import argparse import argparse
import json
import os import os
import sys import sys
...@@ -29,7 +30,7 @@ def main(argv): ...@@ -29,7 +30,7 @@ def main(argv):
help='Path to build directory') help='Path to build directory')
args = parser.parse_args() args = parser.parse_args()
print compile_db.GenerateWithNinja(args.p) print json.dumps(compile_db.GenerateWithNinja(args.p))
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment