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..a33e40955452cbe75a780690afb1ca25eae2f481 |
--- /dev/null |
+++ b/tools/clang/scripts/generate_compdb.py |
@@ -0,0 +1,37 @@ |
+#!/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. |
+ |
+""" |
+Helper for generating compile DBs for clang tooling. On non-Windows platforms, |
+this is pretty straightforward. On Windows, the tool does a bit of extra work to |
+integrate the content of response files, force clang tooling to run in clang-cl |
+mode, etc. |
+""" |
+ |
+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:])) |