[PATCH] D113847: [clang-tidy][NFC] Simplify ClangTidyStats

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 14 09:18:36 PST 2021

carlosgalvezp created this revision.
carlosgalvezp added reviewers: aaron.ballman, whisperity.
Herald added subscribers: rnkovacs, xazax.hun.
carlosgalvezp requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

- Use NSDMI and remove constructor.
- Replace "unsigned" with "int". Unsigned ints should not be used to express that "a number cannot be negative". To count things and perform arithmetic, we should use regular ints. Unsigned ints are useful for e.g. bitwise operations.

  rG LLVM Github Monorepo



Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -45,20 +45,15 @@
   std::vector<std::string> EnabledDiagnosticAliases;
-/// Contains displayed and ignored diagnostic counters for a ClangTidy
-/// run.
+/// Contains displayed and ignored diagnostic counters for a ClangTidy run.
 struct ClangTidyStats {
-  ClangTidyStats()
-      : ErrorsDisplayed(0), ErrorsIgnoredCheckFilter(0), ErrorsIgnoredNOLINT(0),
-        ErrorsIgnoredNonUserCode(0), ErrorsIgnoredLineFilter(0) {}
+  int ErrorsDisplayed{0};
+  int ErrorsIgnoredCheckFilter{0};
+  int ErrorsIgnoredNOLINT{0};
+  int ErrorsIgnoredNonUserCode{0};
+  int ErrorsIgnoredLineFilter{0};
-  unsigned ErrorsDisplayed;
-  unsigned ErrorsIgnoredCheckFilter;
-  unsigned ErrorsIgnoredNOLINT;
-  unsigned ErrorsIgnoredNonUserCode;
-  unsigned ErrorsIgnoredLineFilter;
-  unsigned errorsIgnored() const {
+  int errorsIgnored() const {
     return ErrorsIgnoredNOLINT + ErrorsIgnoredCheckFilter +
            ErrorsIgnoredNonUserCode + ErrorsIgnoredLineFilter;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113847.387099.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211114/f563e41d/attachment-0001.bin>

More information about the cfe-commits mailing list