From e641cb4807d569a9ddf32e289a40df539f75940d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 14 Mar 2016 12:41:24 +0000 Subject: [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 --- clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang-tools-extra/test/clang-tidy/modernize-loop-convert-basic.cpp') 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; -- cgit v1.2.3