[PATCH] D72212: [Sema] Improve -Wrange-loop-analysis warnings
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 4 12:51:59 PST 2020
Mordante created this revision.
Mordante added reviewers: aaron.ballman, xbolva00, MaskRay.
Mordante added a project: clang.
No longer generate a diagnostic when a small trivially copyable type is used without a reference. Before the test looked for a POD type and had no size restriction. Since the range-based for loop is only available in C++11 and POD types are trivially copyable in C++11 it's not required to test for a POD type.
Since copying a large object will be expensive its size has been restricted. 64 bytes is a common size of a cache line and if the object is aligned the copy will be cheap. No performance impact testing has been done.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72212
Files:
clang/lib/Sema/SemaStmt.cpp
clang/test/SemaCXX/warn-range-loop-analysis-trivially-copyable.cpp
clang/test/SemaCXX/warn-range-loop-analysis.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72212.236199.patch
Type: text/x-patch
Size: 4771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200104/366c4696/attachment.bin>
More information about the cfe-commits
mailing list