blob: 783f58ba1d30a5a1eac797f20840bef1472e4b00 [file] [log] [blame]
Richard Smith82f3fc02013-05-24 23:54:21 +00001#!/usr/bin/env bash
Dmitri Gribenko5dc3a692012-02-13 20:21:52 +00002#
3# This script produces a list of all diagnostics that are defined
4# in Diagnostic*.td files but not used in sources.
5#
6
Benjamin Kramer6590abb2013-01-12 21:39:06 +00007# Gather all diagnostic identifiers from the .td files.
8ALL_DIAGS=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' ./include/clang/Basic/Diagnostic*.td)
Dmitri Gribenko5dc3a692012-02-13 20:21:52 +00009
Benjamin Kramer6590abb2013-01-12 21:39:06 +000010# Now look for all potential identifiers in the source files.
Benjamin Kramer07203ca2018-01-25 15:57:22 +000011ALL_SOURCES=$(find lib include tools utils -name \*.cpp -or -name \*.h)
Benjamin Kramer6590abb2013-01-12 21:39:06 +000012DIAGS_IN_SOURCES=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' $ALL_SOURCES)
Dmitri Gribenko5dc3a692012-02-13 20:21:52 +000013
Benjamin Kramer6590abb2013-01-12 21:39:06 +000014# Print all diags that occur in the .td files but not in the source.
Benjamin Kramere2e6e6a2013-01-14 15:00:48 +000015comm -23 <(sort -u <<< "$ALL_DIAGS") <(sort -u <<< "$DIAGS_IN_SOURCES")