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. 5 6# This script returns the flags that should be passed to clang. 7 8THIS_ABS_DIR=$(cd $(dirname $0) && echo $PWD) 9CLANG_LIB_PATH=$THIS_ABS_DIR/../../../third_party/llvm-build/Release+Asserts/lib 10 11if uname -s | grep -q Darwin; then 12 LIBSUFFIX=dylib 13else 14 LIBSUFFIX=so 15fi 16 17LIBNAME=\ 18$(grep LIBRARYNAME "$THIS_ABS_DIR"/../blink_gc_plugin/Makefile \ 19 | cut -d ' ' -f 3) 20 21FLAGS="" 22for arg in "$@"; do 23 if [[ "$arg" = "enable-oilpan=1" ]]; then 24 FLAGS="$FLAGS -Xclang -plugin-arg-blink-gc-plugin -Xclang enable-oilpan" 25 elif [[ "$arg" = "dump-graph=1" ]]; then 26 FLAGS="$FLAGS -Xclang -plugin-arg-blink-gc-plugin -Xclang dump-graph" 27 fi 28done 29 30echo -Xclang -load -Xclang $CLANG_LIB_PATH/lib$LIBNAME.$LIBSUFFIX \ 31 -Xclang -add-plugin -Xclang blink-gc-plugin $FLAGS 32