Commit f82c1236 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Strip /showIncludes from the CompDb

/showIncludes causes clang-tidy to output a lot of unnecessary text to
the console.

BUG=944686

Change-Id: I9e8b2e0912d47c70aef9fae8919ab492a310fb29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538645
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarReid Kleckner <rnk@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644457}
parent 6c0bcf3f
...@@ -101,10 +101,28 @@ def BuildNinjaTarget(out_dir, ninja_target): ...@@ -101,10 +101,28 @@ def BuildNinjaTarget(out_dir, ninja_target):
def GenerateCompDb(out_dir): def GenerateCompDb(out_dir):
gen_compdb_script = os.path.join( gen_compdb_script = os.path.join(
os.path.dirname(__file__), 'generate_compdb.py') os.path.dirname(__file__), 'generate_compdb.py')
comp_db_file = os.path.join(out_dir, 'compile_commands.json') comp_db_file_path = os.path.join(out_dir, 'compile_commands.json')
args = [sys.executable, gen_compdb_script, '-p', out_dir, '-o', comp_db_file] args = [
sys.executable,
gen_compdb_script,
'-p',
out_dir,
'-o',
comp_db_file_path,
]
subprocess.check_call(args) subprocess.check_call(args)
# The resulting CompDb file includes /showIncludes which causes clang-tidy to
# output a lot of unnecessary text to the console.
with open(comp_db_file_path, 'r') as comp_db_file:
comp_db_data = comp_db_file.read();
# The trailing space on /showIncludes helps keep single-spaced flags.
comp_db_data = comp_db_data.replace('/showIncludes ', '')
with open(comp_db_file_path, 'w') as comp_db_file:
comp_db_file.write(comp_db_data)
def RunClangTidy(checks, header_filter, auto_fix, out_dir, ninja_target): def RunClangTidy(checks, header_filter, auto_fix, out_dir, ninja_target):
"""Invoke the |run-clang-tidy.py| script.""" """Invoke the |run-clang-tidy.py| script."""
......
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