Add --target_os=... support to run_tool.py and generate_compdb.py
To consume win32-specific cmdline parameters (e.g. -imsvc, /FI or /Yu) clang needs to be invoked with `--driver-mode=cl`. This CL ensures that the driver-mode cmdline switch is appended not only when running a rewriter tool on Windows, but also when run_tool.py or generate_compdb.py are invoked with an explicit --target_os=win cmdline argument. Manual tests: 1. Manually run unit tests for tools/clang/pylib/clang/compile_db.py: $ pushd tools/clang/pylib/clang/ $ python compile_db_test.py 2. Manually tried running the rewriter on linux, when targeting win: $ cat out/rewrite-win/args.gn clang_use_chrome_plugins = false target_os = "win" $ tools/clang/scripts/run_tool.py --tool rewrite_raw_ptr_fields \ --generate-compdb --target_os=win -p out/rewrite-win \ content/browser/renderer_host/render_process_host_impl.cc \ >~/scratch/rewriter.out 3. Manually tried running generate_compdb.py: $ tools/clang/scripts/generate_compdb.py -p out/rewrite gn_all \ -o ~/scratch/compdb Bug: 1069567 Change-Id: I54fcee164d7bb05119c8267b43e0d872bc2f436b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481745 Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/master@{#818687}
Showing
Please register or sign in to comment