2 ##===- utils/llvmgrep - Counts Lines Of Code -----------------*- Script -*-===##
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 ##===----------------------------------------------------------------------===##
10 # This script searches your srcdir for an egrep style pattern. This can quickly
11 # help you build a list of the places you need to modify when changing a header
12 # or other "global" name. The only argument is the pattern you want to search
13 # for. It should be quoted to escape shell interpretation of the pattern's
16 # Note that the implementation is based on llvmdo. See that script for more
18 ##===----------------------------------------------------------------------===##
20 if test "$1" = "-topdir" ; then
24 TOPDIR
=`llvm-config --src-root`
27 if test -d "$TOPDIR" ; then
30 SunOS
) grep_cmd
="ggrep -H -n" ;;
31 Linux|Darwin
) grep_cmd
="egrep -H -n" ;;
32 *) grep_cmd
="egrep -l -n" ;;
34 .
/utils
/llvmdo
-topdir "$TOPDIR" \
35 -dirs "include lib tools utils docs examples test unittests projects cmake" $grep_cmd "$*"
37 echo "Can't find LLVM top directory"