summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-02-13 20:21:52 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-02-13 20:21:52 +0000
commit51890355535ec66bc136d6fdd842c2031f541e9d (patch)
treeeee11d0f17aff737cb87fd89d5e99d0750c90523 /utils
parent684a8e471b4499c373f7660b319cfc167cb36a66 (diff)
Add a script that produces a list of all diagnostics that are defined in
Diagnostic*.td files but not used in sources. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/find-unused-diagnostics.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/find-unused-diagnostics.sh b/utils/find-unused-diagnostics.sh
new file mode 100644
index 0000000000..89b7f7a700
--- /dev/null
+++ b/utils/find-unused-diagnostics.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# This script produces a list of all diagnostics that are defined
+# in Diagnostic*.td files but not used in sources.
+#
+
+ALL_DIAGS=$(mktemp)
+ALL_SOURCES=$(mktemp)
+
+grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+ ' ./include/clang/Basic/Diagnostic*.td > $ALL_DIAGS
+find lib include tools -name \*.cpp -or -name \*.h > $ALL_SOURCES
+for DIAG in $(cat $ALL_DIAGS); do
+ if ! grep -r $DIAG $(cat $ALL_SOURCES) > /dev/null; then
+ echo $DIAG
+ fi;
+done
+
+rm $ALL_DIAGS $ALL_SOURCES
+