[clang-tidy] Count errors in ClangTidyDiagnosticConsumer

This re-applies r222363 reverted in r222390 after compilation errors in our
out-of-tree clang-tidy tests were fixed.