Revision 107f4ee6837ad78bfac3dad304f4478d3d9b6943 authored by Doug Gregor on 21 January 2016, 00:19:44 UTC, committed by Doug Gregor on 21 January 2016, 01:01:07 UTC
This reverts commit 5c4d1cff64c59a45c8585c7e9cbfd974410c50f6.
1 parent f5dd311
Raw File
find-unused-diagnostics.sh
#!/usr/bin/env bash
#
# This script produces a list of all diagnostics that are defined
# but not used in sources.
#

# Gather all diagnostic identifiers.
ALL_DIAGS=$(grep -E --only-matching --no-filename 'ERROR\([a-z_]+,' include/swift/AST/Diagnostics*.def | sed -e 's/ERROR(//' -e 's/,//')

# Now look for all potential identifiers in the source files.
ALL_SOURCES=$(find lib include tools -name \*.cpp -or -name \*.h)
DIAGS_IN_SOURCES=$(grep -E --only-matching --no-filename 'diag::[a-z_]+' $ALL_SOURCES | sed -e 's/diag:://')

# Print all diags that occur in the .td files but not in the source.
comm -23 <(sort -u <<< "$ALL_DIAGS") <(sort -u <<< "$DIAGS_IN_SOURCES")
back to top