[PATCH] Add -Wrange-loop-analysis to warn when a range-based for-loop is creating a copy.
David Blaikie
dblaikie at gmail.com
Tue Aug 26 19:57:21 PDT 2014
You could probably be a bit narrower than POD types - probably just
types with trivial copy constructors. But for now "all POD types"
shouldn't have any false positives, only false negatives - so perhaps
leave it that way with a FIXME Describing a narrower check for small
types (small to be defined/discovered) with trivial copy construction.
On Tue, Aug 26, 2014 at 5:38 PM, Richard Trieu <rtrieu at google.com> wrote:
> Don't warn when POD types are copied. It's likely that some of the larger POD types should be warned on, but a reasonable limit is needed since copies of smaller POD types is a regular occurrence.
>
> http://reviews.llvm.org/D4169
>
> Files:
> include/clang/Basic/DiagnosticGroups.td
> include/clang/Basic/DiagnosticSemaKinds.td
> lib/Sema/SemaStmt.cpp
> test/SemaCXX/warn-range-loop-analysis.cpp
More information about the cfe-commits
mailing list