[PATCH] D19672: [clang-tidy] cppcoreguidelines-pro-type-member-init should not complain about static variables

Michael Miller via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 12:24:03 PDT 2016


michael_miller added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:284
@@ -283,2 +283,3 @@
       varDecl(isDefinition(), HasDefaultConstructor,
+              hasAutomaticStorageDuration(),
               hasType(recordDecl(has(fieldDecl()),
----------------
alexfh wrote:
> aaron.ballman wrote:
> > We should add a test that this still diagnoses variables with dynamic storage duration. Alternatively, this could be `unless(anyOf(hasStaticStorageDuration(), hasThreadStorageDuration()))`
> I don't think it ever diagnosed on the dynamic storage duration, since it doesn't match `cxxNewExpr` ;)
Perhaps unrelated but a new expression without the parens wouldn't value-initialize a record type with a default constructor and potentially be a problematic. Maybe we should be checking cxxNewExpr.


http://reviews.llvm.org/D19672





More information about the cfe-commits mailing list