minix/external/bsd/llvm/dist/clang/utils/find-unused-diagnostics.sh
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

15 lines
694 B
Bash
Executable file

#!/usr/bin/env bash
#
# This script produces a list of all diagnostics that are defined
# in Diagnostic*.td files but not used in sources.
#
# Gather all diagnostic identifiers from the .td files.
ALL_DIAGS=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' ./include/clang/Basic/Diagnostic*.td)
# 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 '(err_|warn_|ext_|note_)[a-z_]+' $ALL_SOURCES)
# 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")