From 258d607b9f7e5dd0c3e28dd0276de4afa18b7acc Mon Sep 17 00:00:00 2001 From: Zinovy Nis Date: Fri, 13 Apr 2018 08:43:47 +0000 Subject: [PATCH] [clang-tidy] Fix ParentVirtualCallCheck for old MSVS compilers llvm-svn: 329999 --- .../clang-tidy/bugprone/ParentVirtualCallCheck.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp index 7daf742dadac..919a6910f756 100755 --- a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp @@ -28,11 +28,12 @@ static bool isParentOf(const CXXRecordDecl &Parent, const CXXRecordDecl &ThisClass) { if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl()) return true; + const CXXRecordDecl *ParentCanonicalDecl = Parent.getCanonicalDecl(); return ThisClass.bases_end() != llvm::find_if(ThisClass.bases(), [=](const CXXBaseSpecifier &Base) { auto *BaseDecl = Base.getType()->getAsCXXRecordDecl(); assert(BaseDecl); - return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl(); + return ParentCanonicalDecl == BaseDecl->getCanonicalDecl(); }); }