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

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 15 01:27:13 PST 2021


carlosgalvezp added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h:50
 struct ClangTidyStats {
-  ClangTidyStats()
-      : ErrorsDisplayed(0), ErrorsIgnoredCheckFilter(0), ErrorsIgnoredNOLINT(0),
-        ErrorsIgnoredNonUserCode(0), ErrorsIgnoredLineFilter(0) {}
+  int ErrorsDisplayed{0};
+  int ErrorsIgnoredCheckFilter{0};
----------------
whisperity wrote:
> carlosgalvezp wrote:
> > salman-javed-nz wrote:
> > > What's the prevalent style for class member initialization? `=` or `{}`?
> > > cppcoreguidelines-prefer-member-initializer defaults to `{}` but I have seen both types in the code.
> > I tried to find this info in the LLVM coding guidelines but didn't find anything, so I assume it's maybe up to developers' discretion.
> > 
> > I prefer using braced initialization, since it prevents implicit conversions:
> > https://godbolt.org/z/4sP4rGsrY
> > 
> > More strict guidelines like Autosar enforce this. Also CppCoreGuidelines prefer that style as you point out.
> I think this is such a new and within LLVM relatively unused feature (remember we are still pegged to C++14...) that we do not have a consensus on style, and perhaps warrants discussing it on the mailing list.
Just to clarify - this is C++11/14 syntax, nothing really fancy. I'm happy to change to " = 0" if people want, I don't have a strong opinion here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113847/new/

https://reviews.llvm.org/D113847



More information about the cfe-commits mailing list