Revert of Roll Clang 223108:230631 (+revert of r229678) (patchset #5 id:80001 of...
[chromium-blink-merge.git] / tools / clang / scripts / blink_gc_plugin_flags.sh
blob3654808120d5dd3f93598c44cb43db7f3eaf4dc3
1 #!/usr/bin/env bash
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # This script returns the flags that should be passed to clang.
8 SRC_DIR=$(cd $(dirname $0)/../../.. && echo $PWD)
9 CLANG_LIB_PATH=$SRC_DIR/third_party/llvm-build/Release+Asserts/lib
11 if uname -s | grep -q Darwin; then
12 LIBSUFFIX=dylib
13 else
14 LIBSUFFIX=so
16 LIBNAME=\
17 $(grep 'set(LIBRARYNAME' "$SRC_DIR"/tools/clang/blink_gc_plugin/CMakeLists.txt \
18 | cut -d ' ' -f 2 | tr -d ')')
20 FLAGS=""
21 PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang"
22 for arg in "$@"; do
23 if [[ "$arg" = "enable-oilpan=1" ]]; then
24 FLAGS="$FLAGS $PREFIX enable-oilpan"
25 elif [[ "$arg" = "dump-graph=1" ]]; then
26 FLAGS="$FLAGS $PREFIX dump-graph"
27 elif [[ "$arg" = "warn-raw-ptr=1" ]]; then
28 FLAGS="$FLAGS $PREFIX warn-raw-ptr"
29 elif [[ "$arg" = "warn-unneeded-finalizer=1" ]]; then
30 FLAGS="$FLAGS $PREFIX warn-unneeded-finalizer"
32 done
34 echo -Xclang -load -Xclang $CLANG_LIB_PATH/lib$LIBNAME.$LIBSUFFIX \
35 -Xclang -add-plugin -Xclang blink-gc-plugin $FLAGS