diff options
author | poelmanc <cpllvm@stellarscience.com> | 2021-02-07 16:34:05 +0000 |
---|---|---|
committer | Nathan James <n.james93@hotmail.co.uk> | 2021-02-07 16:36:34 +0000 |
commit | 5229edd66742aeed407f774d77d437fa80347ad1 (patch) | |
tree | 791be0d02d1d2ffd23a0c344dedb50cb1487cb58 /llvm/lib/Transforms/Utils/CloneModule.cpp | |
parent | ddca007a291b0e224fe5a492ae8d78c6a933b4fe (diff) | |
download | llvm-5229edd66742aeed407f774d77d437fa80347ad1.zip llvm-5229edd66742aeed407f774d77d437fa80347ad1.tar.gz llvm-5229edd66742aeed407f774d77d437fa80347ad1.tar.bz2 |
[clang-tidy] fix modernize-loop-convert to retain needed array-like operator[]
`modernize-loop-convert` handles //array-like// objects like vectors fairly well, but strips slightly too much information from the iteration expression by converting:
```
Vector<Vector<int>> X;
for (int J = 0; J < X[5].size(); ++J)
copyArg(X[5][J]);
```
to
```
Vector<Vector<int>> X;
for (int J : X) // should be for (int J : X[5])
copyArg(J);
```
The `[5]` is a call to `operator[]` and gets stripped by `LoopConvertCheck::getContainerString`. This patch fixes that and adds several test cases.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D95771
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneModule.cpp')
0 files changed, 0 insertions, 0 deletions