1#!/bin/bash
2
3# Copies the 'demangle' library, excluding 'DemangleConfig.h', to llvm. If no
4# llvm directory is specified, then assume a monorepo layout.
5
6set -e
7
8FILES="ItaniumDemangle.h StringView.h Utility.h README.txt"
9LLVM_DEMANGLE_DIR=$1
10
11if [[ -z "$LLVM_DEMANGLE_DIR" ]]; then
12    LLVM_DEMANGLE_DIR="../../../llvm/include/llvm/Demangle"
13fi
14
15if [[ ! -d "$LLVM_DEMANGLE_DIR" ]]; then
16    echo "No such directory: $LLVM_DEMANGLE_DIR" >&2
17    exit 1
18fi
19
20read -p "This will overwrite the copies of $FILES in $LLVM_DEMANGLE_DIR; are you sure? [y/N]" -n 1 -r ANSWER
21echo
22
23if [[ $ANSWER =~ ^[Yy]$ ]]; then
24    for I in $FILES ; do
25        cp $I $LLVM_DEMANGLE_DIR/$I
26    done
27fi
28