| Index: tools/clang/scripts/generate_win_compdb.py
|
| diff --git a/tools/clang/scripts/generate_win_compdb.py b/tools/clang/scripts/generate_win_compdb.py
|
| index 32f5f753c5316b3489249ae57379a64b92855d29..a7a7ba647d83a926c55c7bf195fcd88022bc6a50 100755
|
| --- a/tools/clang/scripts/generate_win_compdb.py
|
| +++ b/tools/clang/scripts/generate_win_compdb.py
|
| @@ -11,6 +11,7 @@ which also confuses clang. This script generates a compile DB that should mostly
|
| work until clang tooling can be improved upstream.
|
| """
|
|
|
| +import argparse
|
| import os
|
| import re
|
| import json
|
| @@ -60,10 +61,18 @@ def _ProcessEntry(e):
|
|
|
|
|
| def main(argv):
|
| + # Parse argument
|
| + parser = argparse.ArgumentParser()
|
| + parser.add_argument(
|
| + 'build_path',
|
| + nargs='?',
|
| + help='Path to build directory',
|
| + default='out/Debug')
|
| + args = parser.parse_args()
|
| # First, generate the compile database.
|
| print 'Generating compile DB with ninja...'
|
| compile_db_as_json = subprocess.check_output(shlex.split(
|
| - 'ninja -C out/Debug -t compdb cc cxx objc objcxx'))
|
| + 'ninja -C %s -t compdb cc cxx objc objcxx' % args.build_path))
|
|
|
| compile_db = json.loads(compile_db_as_json)
|
| print 'Read in %d entries from the compile db' % len(compile_db)
|
| @@ -74,7 +83,7 @@ def main(argv):
|
| compile_db = [e for e in compile_db if '_nacl.cc.pdb' not in e['command']
|
| and '_nacl_win64.cc.pdb' not in e['command']]
|
| print 'Filtered out %d entries...' % (original_length - len(compile_db))
|
| - f = file('out/Debug/compile_commands.json', 'w')
|
| + f = file('%s/compile_commands.json' % args.build_path, 'w')
|
| f.write(json.dumps(compile_db, indent=2))
|
| print 'Done!'
|
|
|
|
|