1#!/bin/sh
2##===- utils/getsrcs.sh - 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# details.
8#
9##===----------------------------------------------------------------------===##
10#
11# This script just prints out the path names for all the source files in LLVM.
12# The optional -topdir option can be used to specify the top LLVM source
13# directory. Without it, the llvm-config command is consulted to find the
14# top source directory.
15#
16# Note that the implementation is based on llvmdo. See that script for more
17# details.
18##===----------------------------------------------------------------------===##
19
20if test "$1" = "-topdir" ; then
21  TOPDIR="$2"
22  shift; shift;
23else
24  TOPDIR=`llvm-config --src-root`
25fi
26
27if test -d "$TOPDIR" ; then
28  cd $TOPDIR
29  ./utils/llvmdo -topdir "$TOPDIR" \
30    -dirs "include lib tools utils examples projects" echo
31else
32  echo "Can't find LLVM top directory"
33fi
34