#!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. if test $# -lt 1 ; then echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."; exit 1; fi if test "$1" = "-dirs" ; then LLVMDO_DIRS="$2"; shift ; shift elif test -z "$LLVMDO_DIRS" ; then LLVMDO_DIRS="include lib tools test utils docs examples projects" fi PROGRAM=`which $1` if test ! -x "$PROGRAM" ; then echo "Can't execute $1" exit 1 fi shift; ARGS="$*" TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR find $LLVMDO_DIRS -type f \ \( \ -path 'docs/doxygen/*' -o \ -path 'docs/CommandGuide/html/*' -o \ -path 'docs/CommandGuide/man/*' -o \ -path 'docs/CommandGuide/ps/*' -o \ -path 'docs/CommandGuide/man/*' -o \ -path 'docs/HistoricalNotes/*' -o \ -path 'utils/Burg/*' -o \ -path 'docs/img/*' -o \ -path '*/.libs/*' \ \) -prune -o \( \ -name '*.[cdhyltp]*' \ \! -name '.*' \ \! -name '*~' \ \! -name '#*' \ \! -name '*.d' \ \! -name '*.dir' \ \! -name '*.flc' \ \! -name '*.inc' \ \! -name '*.ll' \ \! -name '*.llx' \ \! -name '*.la' \ \! -name '*.lo' \ \! -name 'Sparc.burm.c' \ \! -name 'llvmAsmParser.cpp' \ \! -name 'llvmAsmParser.h' \ \! -name 'FileParser.cpp' \ \! -name 'FileParser.h' \ \! -name 'StackerParser.h' \ \! -name 'StackerParser.cpp' \ -exec $PROGRAM $ARGS {} \; \ \) else echo "Can't find LLVM top directory in $TOPDIR" fi