Dmitri Gribenko | 5189035 | 2012-02-13 20:21:52 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 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 Kramer | 145494a | 2013-01-12 21:39:06 +0000 | [diff] [blame] | 7 | # Gather all diagnostic identifiers from the .td files. |
| 8 | ALL_DIAGS=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' ./include/clang/Basic/Diagnostic*.td) |
Dmitri Gribenko | 5189035 | 2012-02-13 20:21:52 +0000 | [diff] [blame] | 9 | |
Benjamin Kramer | 145494a | 2013-01-12 21:39:06 +0000 | [diff] [blame] | 10 | # Now look for all potential identifiers in the source files. |
| 11 | ALL_SOURCES=$(find lib include tools -name \*.cpp -or -name \*.h) |
| 12 | DIAGS_IN_SOURCES=$(grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+' $ALL_SOURCES) |
Dmitri Gribenko | 5189035 | 2012-02-13 20:21:52 +0000 | [diff] [blame] | 13 | |
Benjamin Kramer | 145494a | 2013-01-12 21:39:06 +0000 | [diff] [blame] | 14 | # Print all diags that occur in the .td files but not in the source. |
Benjamin Kramer | d3e8074 | 2013-01-14 15:00:48 +0000 | [diff] [blame^] | 15 | comm -23 <(sort -u <<< "$ALL_DIAGS") <(sort -u <<< "$DIAGS_IN_SOURCES") |