diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp index c09e3278589..bd476dd5e79 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -352,12 +352,12 @@ static StringRef getStringFromRange(SourceManager &SourceMgr, LangOpts); } -/// \brief If the given expression is actually a DeclRefExpr, find and return -/// the underlying ValueDecl; otherwise, return NULL. +/// \brief If the given expression is actually a DeclRefExpr or a MemberExpr, +/// find and return the underlying ValueDecl; otherwise, return NULL. static const ValueDecl *getReferencedVariable(const Expr *E) { if (const DeclRefExpr *DRE = getDeclRef(E)) return dyn_cast<VarDecl>(DRE->getDecl()); - if (const auto *Mem = dyn_cast<MemberExpr>(E)) + if (const auto *Mem = dyn_cast<MemberExpr>(E->IgnoreParenImpCasts())) return dyn_cast<FieldDecl>(Mem->getMemberDecl()); return nullptr; } |