1*e5dd7070Spatrick#!/usr/bin/env bash 2*e5dd7070Spatrick# 3*e5dd7070Spatrick# This script produces a list of all diagnostics that are defined 4*e5dd7070Spatrick# in Diagnostic*.td files but not used in sources. 5*e5dd7070Spatrick# 6*e5dd7070Spatrick 7*e5dd7070Spatrick# Gather all diagnostic identifiers from the .td files. 8*e5dd7070SpatrickALL_DIAGS=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' ./include/clang/Basic/Diagnostic*.td) 9*e5dd7070Spatrick 10*e5dd7070Spatrick# Now look for all potential identifiers in the source files. 11*e5dd7070SpatrickALL_SOURCES=$(find lib include tools utils -name \*.cpp -or -name \*.h) 12*e5dd7070SpatrickDIAGS_IN_SOURCES=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' $ALL_SOURCES) 13*e5dd7070Spatrick 14*e5dd7070Spatrick# Print all diags that occur in the .td files but not in the source. 15*e5dd7070Spatrickcomm -23 <(sort -u <<< "$ALL_DIAGS") <(sort -u <<< "$DIAGS_IN_SOURCES") 16