alexander-shaposhnikov added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp:220
 void UseEqualsDefaultCheck::registerMatchers(MatchFinder *Finder) {
-  // Skip unions since constructors with empty bodies behave differently
-  // in comparison with structs/classes.
+  // Skip union-like classes since constructors with empty bodies behave
+  // differently in comparison with structs/classes.
----------------
gribozavr2 wrote:
> 
I've come across "union-like" classes here: 
https://en.cppreference.com/w/cpp/language/union
but yeah, will rephrase the comment.


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp:225
+      anyOf(isUnion(),
+            has(fieldDecl(isImplicit(), hasType(cxxRecordDecl(isUnion()))))));
 
----------------
gribozavr2 wrote:
> Why is "isImplicit" needed?
the intention for this patch was to skip classes containing anonymous unions
https://en.cppreference.com/w/cpp/language/union
In this case Clang's AST looks like this:
CXXRecordDecl - /* union */ FieldDecl (implicit) - IndirectFieldDecl - 
IndirectFieldDecl ...
For regular unions I haven't encountered issues yet (on a few large codebases)
(but yeah, might have to revisit it in the future).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132713

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to