[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
[llvm-complete.git] / utils / llvmgrep
blob28b2f95f979800aa6c127ded4da6bd160194b750
1 #!/bin/sh
2 ##===- utils/llvmgrep - Counts Lines Of Code -----------------*- Script -*-===##
3 #
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
7 #
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
14 # special characters.
16 # Note that the implementation is based on llvmdo. See that script for more
17 # details.
18 ##===----------------------------------------------------------------------===##
20 if test "$1" = "-topdir" ; then
21 TOPDIR="$2"
22 shift; shift;
23 else
24 TOPDIR=`llvm-config --src-root`
27 if test -d "$TOPDIR" ; then
28 cd $TOPDIR
29 case `uname -s` in
30 SunOS) grep_cmd="ggrep -H -n" ;;
31 Linux|Darwin) grep_cmd="egrep -H -n" ;;
32 *) grep_cmd="egrep -l -n" ;;
33 esac
34 ./utils/llvmdo -topdir "$TOPDIR" \
35 -dirs "include lib tools utils docs examples test unittests projects cmake" $grep_cmd "$*"
36 else
37 echo "Can't find LLVM top directory"