[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-17 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC330202: [Sema] Warn about memcpying non-trivial C structs. (authored by ahatanak, committed by ). Changed prior to commit: https://reviews.llvm.org/D45310?vs=142705=142815#toc Repository: rC Clang

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Thanks; LGTM. Repository: rC Clang https://reviews.llvm.org/D45310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142705. ahatanak marked an inline comment as done. ahatanak added a comment. Fix indentation. Repository: rC Clang https://reviews.llvm.org/D45310 Files: include/clang/AST/NonTrivialTypeVisitor.h include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/Sema/SemaChecking.cpp:7651 + << PointeeTy << 1); + SearchNonTrivialToCopyField::diag(PointeeTy, Dest, *this); + } else { Indentation seems messed up in these two

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/AST/NonTrivialCStructTypeVisitor.h:30 +if (asDerived().getContext().getAsArrayType(FT)) + return asDerived().visitArray(DK, FT, std::forward(Args)...); + rjmccall wrote: > ahatanak wrote: > >

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142691. ahatanak marked an inline comment as done. ahatanak added a comment. Move method visitArray to the derived classes and pass the array type to the method instead of the QualType. Repository: rC Clang https://reviews.llvm.org/D45310 Files:

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/AST/NonTrivialCStructTypeVisitor.h:30 +if (asDerived().getContext().getAsArrayType(FT)) + return asDerived().visitArray(DK, FT, std::forward(Args)...); + ahatanak wrote: > rjmccall wrote: > >

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 141291. ahatanak marked 3 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D45310 Files: include/clang/AST/NonTrivialTypeVisitor.h include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/AST/NonTrivialCStructTypeVisitor.h:30 +if (asDerived().getContext().getAsArrayType(FT)) + return asDerived().visitArray(DK, FT, std::forward(Args)...); + rjmccall wrote: > Should you have this

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/AST/NonTrivialCStructTypeVisitor.h:12 +// +//===--===// + The header comment here was clearly just copied from another file. I would

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Issue a warning when non-trivial C structs (structs with '__weak' or '__strong' fields) are copied or initialized by calls to memset, bzero, memcpy, and memmove. This is similar to gcc's -Wclass-memaccess warning. It might be