[clang-tidy] Fix ParentVirtualCallCheck for old MSVS compilers
authorZinovy Nis <zinovy.nis@gmail.com>
Fri, 13 Apr 2018 08:43:47 +0000 (08:43 +0000)
committerZinovy Nis <zinovy.nis@gmail.com>
Fri, 13 Apr 2018 08:43:47 +0000 (08:43 +0000)
llvm-svn: 329999

clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp

index 7daf742..919a691 100755 (executable)
@@ -28,11 +28,12 @@ static bool isParentOf(const CXXRecordDecl &Parent,
                        const CXXRecordDecl &ThisClass) {
   if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl())
     return true;
                        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 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();
          });
 }
 
          });
 }