summaryrefslogtreecommitdiffstats
path: root/tools/clang
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2015-03-03 11:12:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-03 19:13:21 +0000
commit070329d32a77224bb62bf9f11fc94ae58a279a79 (patch)
treecf39885a2097798c447144ca7836ba546f5e0eee /tools/clang
parentfce897d260ef5bcd778b34ace234e233f9afa83b (diff)
downloadchromium_src-070329d32a77224bb62bf9f11fc94ae58a279a79.zip
chromium_src-070329d32a77224bb62bf9f11fc94ae58a279a79.tar.gz
chromium_src-070329d32a77224bb62bf9f11fc94ae58a279a79.tar.bz2
Rewrite plugin_flags.sh Bash script in Python.
This is necessary because GN's exec_script only runs Python scripts. This was requested by Nico in https://codereview.chromium.org/971593003/. BUG=462972 TEST=run ./tools/clang/scripts/plugin_flags.py and compare the output with the bash version. They should be exactly the same. R=thakis@chromium.org Review URL: https://codereview.chromium.org/966723003 Cr-Commit-Position: refs/heads/master@{#318924}
Diffstat (limited to 'tools/clang')
-rwxr-xr-xtools/clang/scripts/plugin_flags.py33
-rwxr-xr-xtools/clang/scripts/plugin_flags.sh20
2 files changed, 33 insertions, 20 deletions
diff --git a/tools/clang/scripts/plugin_flags.py b/tools/clang/scripts/plugin_flags.py
new file mode 100755
index 0000000..ae58199
--- /dev/null
+++ b/tools/clang/scripts/plugin_flags.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# Copyright 2015 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.
+
+# This script returns the flags that should be used when GYP_DEFINES contains
+# clang_use_chrome_plugins. The flags are stored in a script so that they can
+# be changed on the bots without requiring a master restart.
+
+import os
+import sys
+
+# Path constants. (All of these should be absolute paths.)
+THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..'))
+CLANG_LIB_PATH = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
+ 'Release+Asserts', 'lib')
+
+if sys.platform == 'darwin':
+ LIBSUFFIX = 'dylib'
+else:
+ LIBSUFFIX = 'so'
+
+LIB_PATH = os.path.join(
+ CLANG_LIB_PATH,
+ 'libFindBadConstructs.' + LIBSUFFIX)
+
+print ('-Xclang -load -Xclang %s'
+ ' -Xclang -add-plugin -Xclang find-bad-constructs'
+ ' -Xclang -plugin-arg-find-bad-constructs'
+ ' -Xclang check-weak-ptr-factory-order'
+ ' -Xclang -plugin-arg-find-bad-constructs'
+ ' -Xclang strict-virtual-specifiers') % LIB_PATH
diff --git a/tools/clang/scripts/plugin_flags.sh b/tools/clang/scripts/plugin_flags.sh
deleted file mode 100755
index 41c25c8..0000000
--- a/tools/clang/scripts/plugin_flags.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2012 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.
-
-# This script returns the flags that should be used when GYP_DEFINES contains
-# clang_use_chrome_plugins. The flags are stored in a script so that they can
-# be changed on the bots without requiring a master restart.
-
-SRC_ABS_DIR=$(cd $(dirname $0)/../../.. && echo $PWD)
-CLANG_LIB_PATH=$SRC_ABS_DIR/third_party/llvm-build/Release+Asserts/lib
-
-if uname -s | grep -q Darwin; then
- LIBSUFFIX=dylib
-else
- LIBSUFFIX=so
-fi
-
-echo -Xclang -load -Xclang $CLANG_LIB_PATH/libFindBadConstructs.$LIBSUFFIX \
- -Xclang -add-plugin -Xclang find-bad-constructs