blob: c24dc6f3ab6a59ba74b3b774ead07a1054f57980 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001#!/bin/sh
2##===- utils/llvmgrep - Counts Lines Of Code -----------------*- Script -*-===##
3#
4# The LLVM Compiler Infrastructure
5#
6# This file was developed by Reid Spencer and is distributed under the
7# University of Illinois Open Source License. See LICENSE.TXT for details.
8#
9##===----------------------------------------------------------------------===##
10#
11# This script searches your srcdir for an egrep style pattern. This can quickly
12# help you build a list of the places you need to modify when changing a header
13# or other "global" name. The only argument is the pattern you want to search
14# for. It should be quoted to escape shell interpretation of the pattern's
15# special characters.
16#
17# Note that the implementation is based on llvmdo. See that script for more
18# details.
19##===----------------------------------------------------------------------===##
20
21if test "$1" = "-topdir" ; then
22 TOPDIR="$2"
23 shift; shift;
24else
25 TOPDIR=`llvm-config --src-root`
26fi
27
28if test -d "$TOPDIR" ; then
29 cd $TOPDIR
30 case `uname -s` in
31 SunOS) grep_cmd="ggrep -H -n" ;;
32 Linux) grep_cmd="egrep -H -n" ;;
33 *) grep_cmd="egrep -l -n" ;;
34 esac
35 ./utils/llvmdo -topdir "$TOPDIR" \
36 -dirs "include lib tools utils docs examples test projects" $grep_cmd "$*"
37else
38 echo "Can't find LLVM top directory"
39fi