llvm.org GIT mirror llvm / 2d67208
A utility to search the LLVM source tree for a grep pattern. This is a replacement for getsrcs.sh which now generates too much text to put on a Linux command line. The approach taken with llvmgrep is to execute a find command and execute a grep on each file that matches the name pattern. The arguments to this script are the same as those of egrep. Note that the -H and -n options to egrep will always be passed so that you always get the file and line number of matches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14255 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 15 years ago
1 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 #!/bin/sh
1 # This is useful because it prints out all of the source files. Useful for
2 # greps.
3 PATTERN=$*
4 TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'`
5 if test -d "$TOPDIR" ; then
6 cd $TOPDIR
7 find docs include lib tools utils projects -type f \
8 \( -path '*/doxygen/*' -o -path '*/Burg/*' \) -prune -o \
9 -name '*.[cdhyl]*' \
10 \! -name '*~' \
11 \! -name '#*' \
12 \! -name '*.ll' \
13 \! -name '*.d' \
14 \! -name '*.dir' \
15 \! -name 'Sparc.burm.c' \
16 \! -name 'llvmAsmParser.cpp' \
17 \! -name 'llvmAsmParser.h' \
18 \! -name 'FileParser.cpp' \
19 \! -name 'FileParser.h' \
20 -exec egrep -H -n $PATTERN {} \;
21 fi