[clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 9 09:42:54 PDT 2018


On Fri, Apr 6, 2018 at 10:42 PM Zinovy Nis via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: zinovy.nis
> Date: Fri Apr  6 13:39:23 2018
> New Revision: 329452
>
> URL: http://llvm.org/viewvc/llvm-project?rev=329452&view=rev
> Log:
> [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp
>
>
> Modified:
>     clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp?rev=329452&r1=329451&r2=329452&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> Fri Apr  6 13:39:23 2018
> @@ -11,8 +11,8 @@
>  #include "clang/AST/ASTContext.h"
>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>  #include "clang/Tooling/FixIt.h"
> -#include "llvm/ADT/STLExtras.h"
>  #include "llvm/ADT/SmallVector.h"
> +#include <algorithm>
>  #include <cctype>
>
>  using namespace clang::ast_matchers;
> @@ -27,11 +27,13 @@ static bool isParentOf(const CXXRecordDe
>                         const CXXRecordDecl &ThisClass) {
>    if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl())
>      return true;
> -  const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto &Base)
> {
> -    auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
> -    assert(BaseDecl);
> -    return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
> -  });
> +  const auto ClassIter = std::find_if(
>

So what was wrong with llvm::find_if? Why didn't it work here?


> +      ThisClass.bases().begin(), ThisClass.bases().end(),
> +      [=](const CXXBaseSpecifier &Base) {
> +        auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
> +        assert(BaseDecl);
> +        return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
> +      });
>    return ClassIter != ThisClass.bases_end();
>  }
>
> @@ -74,7 +76,8 @@ static std::string getNameAsString(const
>  static std::string getExprAsString(const clang::Expr &E,
>                                     clang::ASTContext &AC) {
>    std::string Text = tooling::fixit::getText(E, AC).str();
> -  Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
> +  Text.erase(std::remove_if(Text.begin(), Text.end(), std::isspace),
> +             Text.end());
>    return Text;
>  }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180409/79b20421/attachment-0001.html>


More information about the cfe-commits mailing list