Home | History | Annotate | Download | only in tools
      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 
      6 set -e
      7 
      8 if [ -z "$1" ]; then
      9   (>&2 echo "Usage: collect_deprecation_stats.sh [<outdir>|<log>]")
     10   exit 1
     11 fi
     12 
     13 if [ -d "$1" ]; then
     14   OUTDIR=$1
     15   FULL_LOG=/tmp/get_isolate_deprecation.log
     16   gn clean "$OUTDIR"
     17   autoninja -C "$OUTDIR" > $FULL_LOG
     18 else
     19   FULL_LOG=$1
     20 fi
     21 
     22 FILTERED_LOG=/tmp/filtered_isolate_deprecation.log
     23 UNIQUE_WARNINGS_LOG=/tmp/unique_warnings.log
     24 
     25 grep "warning:" "$FULL_LOG" | sed $'
     26 s|^\.\./\.\./||;
     27 s/: warning: \'/: /;
     28 
     29 # strip everything after deprecated function name (including template param).
     30 s/\(<.*>\)\\?\'.*//' > $FILTERED_LOG
     31 
     32 sort -u $FILTERED_LOG > $UNIQUE_WARNINGS_LOG
     33 
     34 echo "Total deprecated calls: $(wc -l < $UNIQUE_WARNINGS_LOG)"
     35 cut -f2 -d' ' $UNIQUE_WARNINGS_LOG | sort | uniq -c
     36