Index: tools/clang/scripts/generate_compdb.py |
diff --git a/tools/clang/scripts/generate_compdb.py b/tools/clang/scripts/generate_compdb.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..318f968729243e9e5fea52414aea8a5e602c2883 |
--- /dev/null |
+++ b/tools/clang/scripts/generate_compdb.py |
@@ -0,0 +1,38 @@ |
+#!/usr/bin/env python |
+# Copyright 2014 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+""" |
+Clang tools on Windows are still a bit busted. The tooling can't handle |
+backslashes in paths, doesn't understand how to read .rsp files, etc. In |
+addition, ninja generates compile commands prefixed with the ninja msvc helper, |
+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 sys |
+ |
+script_dir = os.path.dirname(os.path.realpath(__file__)) |
+tool_dir = os.path.abspath(os.path.join(script_dir, '../pylib')) |
+sys.path.insert(0, tool_dir) |
+ |
+from clang import compile_db |
+ |
+ |
+def main(argv): |
+ parser = argparse.ArgumentParser() |
+ parser.add_argument( |
+ 'build_path', |
+ nargs='?', |
+ help='Path to build directory', |
+ default='out/Debug') |
+ args = parser.parse_args() |
+ |
+ compile_db.GenerateWithNinja(args.build_path) |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main(sys.argv[1:])) |