2013-05-25 07:54:21 +08:00
|
|
|
#!/usr/bin/env bash
|
2012-02-14 04:21:52 +08:00
|
|
|
#
|
|
|
|
# This script produces a list of all diagnostics that are defined
|
|
|
|
# in Diagnostic*.td files but not used in sources.
|
|
|
|
#
|
|
|
|
|
2013-01-13 05:39:06 +08:00
|
|
|
# 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)
|
2012-02-14 04:21:52 +08:00
|
|
|
|
2013-01-13 05:39:06 +08:00
|
|
|
# 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)
|
2012-02-14 04:21:52 +08:00
|
|
|
|
2013-01-13 05:39:06 +08:00
|
|
|
# Print all diags that occur in the .td files but not in the source.
|
2013-01-14 23:00:48 +08:00
|
|
|
comm -23 <(sort -u <<< "$ALL_DIAGS") <(sort -u <<< "$DIAGS_IN_SOURCES")
|