[PATCH] D12675: Avoid using rvalue references with trivially copyable types.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 7 08:32:49 PDT 2015
klimek added inline comments.
================
Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:555-564
@@ +554,12 @@
+ Descriptor.DerefByValue = true;
+ // Try to find the type of the elements on the container from the
+ // usages. We can assume that we have at least one (non-const) Usage,
+ // because usagesAreConst() returned false.
+ for (const Usage &U : Usages) {
+ if (!U.Expression || U.Expression->getType().isNull())
+ continue;
+ QualType Type = U.Expression->getType().getCanonicalType();
+ if (U.IsArrow) {
+ if (!Type->isPointerType())
+ continue;
+ Type = Type->getPointeeType();
----------------
a) please add a regression test for everything you find during development
b) I think the comment that we can assume that we have at least one non-const usage is not helpful any more, as we're not just accessing [0] any more.
http://reviews.llvm.org/D12675
More information about the cfe-commits
mailing list