diff options
| author | Don Hinton <hintonda@gmail.com> | 2019-05-15 17:47:51 +0000 |
|---|---|---|
| committer | Don Hinton <hintonda@gmail.com> | 2019-05-15 17:47:51 +0000 |
| commit | 4c50e64fc5cf945c77dd0396bd969fdbdab83e4e (patch) | |
| tree | ae1497bd7b88ca2af1dfbcf670f17f0b1c930189 /clang-tools-extra/clang-tidy/modernize | |
| parent | 4ecb581188ff34c049eb2e9f36b32ae6df532221 (diff) | |
| download | bcm5719-llvm-4c50e64fc5cf945c77dd0396bd969fdbdab83e4e.tar.gz bcm5719-llvm-4c50e64fc5cf945c77dd0396bd969fdbdab83e4e.zip | |
[clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with correct attribution
Summary:
modernize-loop-convert was not detecting implicit casts to
const_iterator as convertible to range-based loops:
std::vector<int> vec{1,2,3,4}
for(std::vector<int>::const_iterator i = vec.begin();
i != vec.end();
++i) { }
Thanks to Don Hinton for advice.
As well, this change adds a note for this check's applicability to code
targeting OpenMP prior version 5 as this check will continue breaking
compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this
out.
Fixes PR#35082
Patch by Torbjörn Klatt!
Reviewed By: hintonda
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D61827
llvm-svn: 360788
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp index f9e941c2016..0e59a8848d8 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -791,11 +791,6 @@ bool LoopConvertCheck::isConvertible(ASTContext *Context, CanonicalBeginType->getPointeeType(), CanonicalInitVarType->getPointeeType())) return false; - } else if (!Context->hasSameType(CanonicalInitVarType, - CanonicalBeginType)) { - // Check for qualified types to avoid conversions from non-const to const - // iterator types. - return false; } } else if (FixerKind == LFK_PseudoArray) { // This call is required to obtain the container. |

