diff options
author | Haojian Wu <hokein@google.com> | 2016-03-14 12:41:24 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2016-03-14 12:41:24 +0000 |
commit | e641cb4807d569a9ddf32e289a40df539f75940d (patch) | |
tree | 9a89982766630d6cf566143e09e9e78af8e2d347 /clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | |
parent | 22c997deb69f36b73675f0a07545de7127a0eb83 (diff) | |
download | llvm-e641cb4807d569a9ddf32e289a40df539f75940d.zip llvm-e641cb4807d569a9ddf32e289a40df539f75940d.tar.gz llvm-e641cb4807d569a9ddf32e289a40df539f75940d.tar.bz2 |
[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/clang-tidy/modernize/LoopConvertUtils.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp index 03f8583..5894a8b 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp @@ -391,8 +391,8 @@ static bool isAliasDecl(ASTContext *Context, const Decl *TheDecl, // This check is needed because getMethodDecl can return nullptr if the // callee is a member function pointer. const auto *MDecl = MemCall->getMethodDecl(); - if (MDecl && !isa<CXXConversionDecl>(MDecl) && MDecl->getName() == "at" && - MemCall->getNumArgs() == 1) { + if (MDecl && !isa<CXXConversionDecl>(MDecl) && + MDecl->getNameAsString() == "at" && MemCall->getNumArgs() == 1) { return isIndexInSubscriptExpr(MemCall->getArg(0), IndexVar); } return false; |