summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-03-14 12:41:24 +0000
committerHaojian Wu <hokein@google.com>2016-03-14 12:41:24 +0000
commite641cb4807d569a9ddf32e289a40df539f75940d (patch)
tree9a89982766630d6cf566143e09e9e78af8e2d347 /clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp
parent22c997deb69f36b73675f0a07545de7127a0eb83 (diff)
downloadbcm5719-llvm-e641cb4807d569a9ddf32e289a40df539f75940d.tar.gz
bcm5719-llvm-e641cb4807d569a9ddf32e289a40df539f75940d.zip
[clang-tidy] Fix "Name is not a simple identifier" assertion in `modernize-loop-convert` check.
Summary: Fix assertion failure: "Name is not a simple identifier". `Decl::GetName` assumes the name should be an identifier. When the check processes the function calling statement with speciail key name like 'it.operator->()', it will trigger the assert in `GetName`. Rather than using `Decl::GetName`, we use `getNameAsString` which works with special key names in C++. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18141 llvm-svn: 263426
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp b/clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp
index cc5b8afc747..def7c4bb2d2 100644
--- a/clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp
+++ b/clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp
@@ -320,6 +320,10 @@ void f() {
// CHECK-FIXES: for (auto & It : Uu)
// CHECK-FIXES-NEXT: printf("s has value %d\n", It.X);
+ for (U::iterator It = Uu.begin(), E = Uu.end(); It != E; ++It) {
+ Val* a = It.operator->();
+ }
+
U::iterator A;
for (U::iterator I = Uu.begin(), E = Uu.end(); I != E; ++I)
int K = A->X + I->X;
OpenPOWER on IntegriCloud