angelgarcia updated this revision to Diff 34535.
angelgarcia added a comment.
Add examples of 'default' usages.
http://reviews.llvm.org/D12734
Files:
clang-tidy/modernize/LoopConvertCheck.cpp
clang-tidy/modernize/LoopConvertCheck.h
clang-tidy/modernize/LoopConvertUtils.cpp
clang-tidy/mo
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.
In http://reviews.llvm.org/D12734#243157, @angelgarcia wrote:
> Comment the enumerators.
>
> > Do we need default?
>
>
> I think so. We need to set the cases that do not fall in any of these
>
angelgarcia updated this revision to Diff 34428.
angelgarcia added a comment.
Comment the enumerators.
> Do we need default?
I think so. We need to set the cases that do not fall in any of these
categories to something, and I think that using one of the other three as the
default kind would b
klimek added inline comments.
Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:468-470
@@ +467,5 @@
+// are VarDecl). If the index is captured by value, add '&' to capture
+// by reference instead.
+ReplaceText =
+Usage.Kind == Usage::UK_Ca
angelgarcia updated this revision to Diff 34427.
angelgarcia added a comment.
Replace the IsArrow field of Usage with an enum.
http://reviews.llvm.org/D12734
Files:
clang-tidy/modernize/LoopConvertCheck.cpp
clang-tidy/modernize/LoopConvertCheck.h
clang-tidy/modernize/LoopConvertUtils.cpp
klimek added inline comments.
Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:765-766
@@ -764,2 +764,4 @@
// exactly one usage.
- addUsage(Usage(nullptr, false, C->getLocation()));
+ // We are using the 'IsArrow' field of Usage to store if we have to add
+
angelgarcia updated this revision to Diff 34422.
angelgarcia marked 4 inline comments as done.
angelgarcia added a comment.
Document Usage's fields and other comments.
http://reviews.llvm.org/D12734
Files:
clang-tidy/modernize/LoopConvertCheck.cpp
clang-tidy/modernize/LoopConvertCheck.h
c
klimek added inline comments.
Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:458
@@ -438,2 +457,3 @@
// variable.
for (const auto &I : Usages) {
+ std::string ReplaceText;
I'd call that 'Usage' here, as it's not an iterator.
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.
1. Avoid converting loops that iterate over the size of a container and don't
use its elements, as this would result in an unused-result warning.
2. Never capture the eleme