1#!/bin/bash 2 3# Collect the number of [[deprecated]] calls detected when compiling V8. 4# Requires "v8_deprecate_get_isolate = true" to be useful. 5 6set -e 7 8if [ -z "$1" ]; then 9 (>&2 echo "Usage: collect_deprecation_stats.sh [<outdir>|<log>]") 10 exit 1 11fi 12 13if [ -d "$1" ]; then 14 OUTDIR=$1 15 FULL_LOG=/tmp/get_isolate_deprecation.log 16 gn clean "$OUTDIR" 17 autoninja -C "$OUTDIR" > $FULL_LOG 18else 19 FULL_LOG=$1 20fi 21 22FILTERED_LOG=/tmp/filtered_isolate_deprecation.log 23UNIQUE_WARNINGS_LOG=/tmp/unique_warnings.log 24 25grep "warning:" "$FULL_LOG" | sed $' 26s|^\.\./\.\./||; 27s/: warning: \'/: /; 28 29# strip everything after deprecated function name (including template param). 30s/\(<.*>\)\\?\'.*//' > $FILTERED_LOG 31 32sort -u $FILTERED_LOG > $UNIQUE_WARNINGS_LOG 33 34echo "Total deprecated calls: $(wc -l < $UNIQUE_WARNINGS_LOG)" 35cut -f2 -d' ' $UNIQUE_WARNINGS_LOG | sort | uniq -c 36