Path: blob/main/system/lib/libcxxabi/src/demangle/cp-to-llvm.sh
6193 views
#!/bin/bash12# Copies the 'demangle' library, excluding 'DemangleConfig.h', to llvm. If no3# llvm directory is specified, then assume a monorepo layout.45set -e67cd $(dirname $0)8HDRS="ItaniumDemangle.h ItaniumNodes.def StringViewExtras.h Utility.h"9TEST_HDRS="DemangleTestCases.inc"10LLVM_DEMANGLE_DIR=$111LLVM_TESTING_DIR=1213if [[ -z "$LLVM_DEMANGLE_DIR" ]]; then14LLVM_DEMANGLE_DIR="../../../llvm/include/llvm/Demangle"15LLVM_TESTING_DIR=$LLVM_DEMANGLE_DIR/../Testing/Demangle16fi1718if [[ ! -d "$LLVM_DEMANGLE_DIR" ]]; then19echo "No such directory: $LLVM_DEMANGLE_DIR" >&220exit 121fi2223if [[ ! -d "$LLVM_TESTING_DIR" ]]; then24LLVM_TESTING_DIR="../../../llvm/include/llvm/Testing/Demangle"25fi2627if [[ ! -d "$LLVM_TESTING_DIR" ]]; then28echo "No such directory: $LLVM_TESTING_DIR" >&229exit 130fi3132read -p "This will overwrite the copies of $HDRS in $LLVM_DEMANGLE_DIR and $TEST_HDRS in $LLVM_TESTING_DIR; are you sure? [y/N]" -n 1 -r ANSWER33echo3435copy_files() {36local src=$137local dst=$238local hdrs=$33940cp -f README.txt $dst41chmod -w $dst/README.txt4243for I in $hdrs ; do44rm -f $dst/$I45dash=$(echo "$I---------------------------" | cut -c -27 |\46sed 's|[^-]*||')47sed -e '1s|^//=*-* .*\..* -*.*=*// *$|//===--- '"$I $dash"'-*- mode:c++;eval:(read-only-mode) -*-===//|' \48-e '2s|^// *$|// Do not edit! See README.txt.|' \49$src/$I >$dst/$I50chmod -w $dst/$I51done52}5354if [[ $ANSWER =~ ^[Yy]$ ]]; then55copy_files . $LLVM_DEMANGLE_DIR $HDRS56copy_files ../../test $LLVM_TESTING_DIR $TEST_HDRS57fi585960