[clang] [Sema] Use llvm::erase_if (NFC) (PR #96068)
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/96068 While I am at it, I'm constructing SmallVector directly from ArrayRef. >From 85dd4232f6510055a536bd5f7f0ce21a06295dfd Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 19 Jun 2024 06:06:15 -0700 Subject: [PATCH] [Sema] Use llvm::erase_if (NFC) While I am at it, I'm constructing SmallVector directly from ArrayRef. --- clang/lib/Sema/SemaOpenACC.cpp | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp index 97586a037eee4..cf207be33175c 100644 --- a/clang/lib/Sema/SemaOpenACC.cpp +++ b/clang/lib/Sema/SemaOpenACC.cpp @@ -841,14 +841,10 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitAttachClause( // ActOnVar ensured that everything is a valid variable reference, but we // still have to make sure it is a pointer type. - llvm::SmallVector VarList{Clause.getVarList().begin(), -Clause.getVarList().end()}; - VarList.erase(std::remove_if(VarList.begin(), VarList.end(), - [&](Expr *E) { - return SemaRef.CheckVarIsPointerType( - OpenACCClauseKind::Attach, E); - }), -VarList.end()); + llvm::SmallVector VarList{Clause.getVarList()}; + llvm::erase_if(VarList, [&](Expr *E) { +return SemaRef.CheckVarIsPointerType(OpenACCClauseKind::Attach, E); + }); Clause.setVarListDetails(VarList, /*IsReadOnly=*/false, /*IsZero=*/false); return OpenACCAttachClause::Create(Ctx, Clause.getBeginLoc(), @@ -866,14 +862,10 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause( // ActOnVar ensured that everything is a valid variable reference, but we // still have to make sure it is a pointer type. - llvm::SmallVector VarList{Clause.getVarList().begin(), -Clause.getVarList().end()}; - VarList.erase(std::remove_if(VarList.begin(), VarList.end(), - [&](Expr *E) { - return SemaRef.CheckVarIsPointerType( - OpenACCClauseKind::DevicePtr, E); - }), -VarList.end()); + llvm::SmallVector VarList{Clause.getVarList()}; + llvm::erase_if(VarList, [&](Expr *E) { +return SemaRef.CheckVarIsPointerType(OpenACCClauseKind::DevicePtr, E); + }); Clause.setVarListDetails(VarList, /*IsReadOnly=*/false, /*IsZero=*/false); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Sema] Use llvm::erase_if (NFC) (PR #96068)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) Changes While I am at it, I'm constructing SmallVector directly from ArrayRef. --- Full diff: https://github.com/llvm/llvm-project/pull/96068.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaOpenACC.cpp (+8-16) ``diff diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp index 97586a037eee4..cf207be33175c 100644 --- a/clang/lib/Sema/SemaOpenACC.cpp +++ b/clang/lib/Sema/SemaOpenACC.cpp @@ -841,14 +841,10 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitAttachClause( // ActOnVar ensured that everything is a valid variable reference, but we // still have to make sure it is a pointer type. - llvm::SmallVector VarList{Clause.getVarList().begin(), -Clause.getVarList().end()}; - VarList.erase(std::remove_if(VarList.begin(), VarList.end(), - [&](Expr *E) { - return SemaRef.CheckVarIsPointerType( - OpenACCClauseKind::Attach, E); - }), -VarList.end()); + llvm::SmallVector VarList{Clause.getVarList()}; + llvm::erase_if(VarList, [&](Expr *E) { +return SemaRef.CheckVarIsPointerType(OpenACCClauseKind::Attach, E); + }); Clause.setVarListDetails(VarList, /*IsReadOnly=*/false, /*IsZero=*/false); return OpenACCAttachClause::Create(Ctx, Clause.getBeginLoc(), @@ -866,14 +862,10 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause( // ActOnVar ensured that everything is a valid variable reference, but we // still have to make sure it is a pointer type. - llvm::SmallVector VarList{Clause.getVarList().begin(), -Clause.getVarList().end()}; - VarList.erase(std::remove_if(VarList.begin(), VarList.end(), - [&](Expr *E) { - return SemaRef.CheckVarIsPointerType( - OpenACCClauseKind::DevicePtr, E); - }), -VarList.end()); + llvm::SmallVector VarList{Clause.getVarList()}; + llvm::erase_if(VarList, [&](Expr *E) { +return SemaRef.CheckVarIsPointerType(OpenACCClauseKind::DevicePtr, E); + }); Clause.setVarListDetails(VarList, /*IsReadOnly=*/false, /*IsZero=*/false); `` https://github.com/llvm/llvm-project/pull/96068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Sema] Use llvm::erase_if (NFC) (PR #96068)
https://github.com/Sirraide approved this pull request. https://github.com/llvm/llvm-project/pull/96068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Sema] Use llvm::erase_if (NFC) (PR #96068)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/96068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits