X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Fllvmgrep;h=7d7355ba9904b52cfca9edc9ab77771771556018;hb=f45a82890e34984ad1e1e259f8fb902caddfb0b1;hp=a1f77636c4fc518b4047c4bf1246b9bf5e18fb27;hpb=054defa74604dcc88db7ce9175122de785992b7b;p=oota-llvm.git diff --git a/utils/llvmgrep b/utils/llvmgrep index a1f77636c4f..7d7355ba990 100755 --- a/utils/llvmgrep +++ b/utils/llvmgrep @@ -3,8 +3,8 @@ # # The LLVM Compiler Infrastructure # -# This file was developed by Reid Spencer and is distributed under the -# University of Illinois Open Source License. See LICENSE.TXT for details. +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## # @@ -18,7 +18,13 @@ # details. ##===----------------------------------------------------------------------===## -TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` +if test "$1" = "-topdir" ; then + TOPDIR="$2" + shift; shift; +else + TOPDIR=`llvm-config --src-root` +fi + if test -d "$TOPDIR" ; then cd $TOPDIR case `uname -s` in @@ -26,7 +32,8 @@ if test -d "$TOPDIR" ; then Linux) grep_cmd="egrep -H -n" ;; *) grep_cmd="egrep -l -n" ;; esac - ./utils/llvmdo -dirs "include lib tools utils docs examples test projects" $grep_cmd "$*" + ./utils/llvmdo -topdir "$TOPDIR" \ + -dirs "include lib tools utils docs examples test projects" $grep_cmd "$*" else - echo "Can't find LLVM top directory in $TOPDIR" + echo "Can't find LLVM top directory" fi