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