From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- clang/lib/AST/ParentMapContext.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'clang/lib/AST/ParentMapContext.cpp') diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp index e0d4700e4b10..21cfd5b1de6e 100644 --- a/clang/lib/AST/ParentMapContext.cpp +++ b/clang/lib/AST/ParentMapContext.cpp @@ -99,7 +99,7 @@ class ParentMapContext::ParentMap { return llvm::ArrayRef(); } if (const auto *V = I->second.template dyn_cast()) { - return llvm::makeArrayRef(*V); + return llvm::ArrayRef(*V); } return getSingleDynTypedNodeFromParentMap(I->second); } @@ -252,7 +252,7 @@ public: const auto *S = It->second.dyn_cast(); if (!S) { if (auto *Vec = It->second.dyn_cast()) - return llvm::makeArrayRef(*Vec); + return llvm::ArrayRef(*Vec); return getSingleDynTypedNodeFromParentMap(It->second); } const auto *P = dyn_cast(S); @@ -265,16 +265,6 @@ public: } }; -template -auto tuple_pop_front_impl(const Tuple &tuple, std::index_sequence) { - return std::make_tuple(std::get<1 + Is>(tuple)...); -} - -template auto tuple_pop_front(const Tuple &tuple) { - return tuple_pop_front_impl( - tuple, std::make_index_sequence::value - 1>()); -} - template struct MatchParents { static std::tuple match(const DynTypedNodeList &NodeList, @@ -285,10 +275,11 @@ template struct MatchParents { if (NextParentList.size() == 1) { auto TailTuple = MatchParents::match(NextParentList, ParentMap); if (std::get(TailTuple)) { - return std::tuple_cat( - std::make_tuple(true, std::get(TailTuple), - TypedNode), - tuple_pop_front(tuple_pop_front(TailTuple))); + return std::apply( + [TypedNode](bool, DynTypedNodeList NodeList, auto... TupleTail) { + return std::make_tuple(true, NodeList, TypedNode, TupleTail...); + }, + TailTuple); } } } -- cgit v1.2.3