diff options
Diffstat (limited to 'chromium/tools/clang/scripts/blink_gc_plugin_flags.sh')
-rwxr-xr-x | chromium/tools/clang/scripts/blink_gc_plugin_flags.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/chromium/tools/clang/scripts/blink_gc_plugin_flags.sh b/chromium/tools/clang/scripts/blink_gc_plugin_flags.sh new file mode 100755 index 00000000000..25c587294b0 --- /dev/null +++ b/chromium/tools/clang/scripts/blink_gc_plugin_flags.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# 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. + +# This script returns the flags that should be passed to clang. + +THIS_ABS_DIR=$(cd $(dirname $0) && echo $PWD) +CLANG_LIB_PATH=$THIS_ABS_DIR/../../../third_party/llvm-build/Release+Asserts/lib + +if uname -s | grep -q Darwin; then + LIBSUFFIX=dylib +else + LIBSUFFIX=so +fi + +LIBNAME=\ +$(grep LIBRARYNAME "$THIS_ABS_DIR"/../blink_gc_plugin/Makefile \ + | cut -d ' ' -f 3) + +FLAGS="" +for arg in "$@"; do + if [[ "$arg" = "enable-oilpan=1" ]]; then + FLAGS="$FLAGS -Xclang -plugin-arg-blink-gc-plugin -Xclang enable-oilpan" + elif [[ "$arg" = "dump-graph=1" ]]; then + FLAGS="$FLAGS -Xclang -plugin-arg-blink-gc-plugin -Xclang dump-graph" + fi +done + +echo -Xclang -load -Xclang $CLANG_LIB_PATH/lib$LIBNAME.$LIBSUFFIX \ + -Xclang -add-plugin -Xclang blink-gc-plugin $FLAGS |