diff options
| author | Angel Garcia Gomez <angelgarcia@google.com> | 2015-08-26 17:08:24 +0000 |
|---|---|---|
| committer | Angel Garcia Gomez <angelgarcia@google.com> | 2015-08-26 17:08:24 +0000 |
| commit | 8409e88fdef77a4970b067706d24cd70a347aadd (patch) | |
| tree | 80e6a94ea04ec5d63fa05d54ea73021d4a852276 /clang-tools-extra/clang-tidy | |
| parent | bf891b12b4a8fe0e64f89101e1d4ff451de923ec (diff) | |
| download | bcm5719-llvm-8409e88fdef77a4970b067706d24cd70a347aadd.tar.gz bcm5719-llvm-8409e88fdef77a4970b067706d24cd70a347aadd.zip | |
Fix another LoopConvert fail.
Summary: Prevent LoopConvert from taking as alias anything that comes from a random member function call.
Reviewers: alexfh
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D12370
llvm-svn: 246039
Diffstat (limited to 'clang-tools-extra/clang-tidy')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp index 0058ea6ba60..ace0aee3114 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp @@ -368,8 +368,14 @@ static bool isAliasDecl(const Decl *TheDecl, const VarDecl *IndexVar) { break; } - case Stmt::CXXMemberCallExprClass: - return true; + case Stmt::CXXMemberCallExprClass: { + const auto *MemCall = cast<CXXMemberCallExpr>(Init); + if (MemCall->getMethodDecl()->getName() == "at") { + assert(MemCall->getNumArgs() == 1); + return isIndexInSubscriptExpr(MemCall->getArg(0), IndexVar); + } + return false; + } default: break; |

