[PATCH] D61827: [clang-tidy] modernize-loop-convert: impl const cast iter
Don Hinton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 11 12:28:00 PDT 2019
hintonda added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp:273
+ for (S::const_iterator It = Ss.begin(), E = Ss.end(); It != E; ++It) {
+ printf("s has value %d\n", (*It).X);
----------------
I think you need to fix the comment and add checks to these also, which is what the `if else` was dealing with:
434 // V.begin() returns a user-defined type 'iterator' which, since it's
435 // different from const_iterator, disqualifies these loops from
436 // transformation.
437 dependent<int> V;
438 for (dependent<int>::const_iterator It = V.begin(), E = V.end();
439 It != E; ++It) {
440 printf("Fibonacci number is %d\n", *It);
441 }
442
443 for (dependent<int>::const_iterator It(V.begin()), E = V.end();
444 It != E; ++It) {
445 printf("Fibonacci number is %d\n", *It);
446 }
447 }
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61827/new/
https://reviews.llvm.org/D61827
More information about the cfe-commits
mailing list