Author: Victor Vianna Date: 2025-10-15T17:25:46+02:00 New Revision: 16dfd317f38ebfc0bd39a5e20e2a8851daa4f8b8
URL: https://github.com/llvm/llvm-project/commit/16dfd317f38ebfc0bd39a5e20e2a8851daa4f8b8 DIFF: https://github.com/llvm/llvm-project/commit/16dfd317f38ebfc0bd39a5e20e2a8851daa4f8b8.diff LOG: [llvm] Fix C++23 error in ParentMapContext (#163553) ParentMapContext::ParentMapContext(ASTContext &Ctx) instantiates ~unique_ptr<ParentMapContext::ParentMap>, so it must be defined after that class is a complete type. Co-authored-by: Victor Hugo Vianna Silva <[email protected]> Added: Modified: clang/lib/AST/ParentMapContext.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp index acc011cb2faa4..7138dffb46e19 100644 --- a/clang/lib/AST/ParentMapContext.cpp +++ b/clang/lib/AST/ParentMapContext.cpp @@ -20,36 +20,6 @@ using namespace clang; -ParentMapContext::ParentMapContext(ASTContext &Ctx) : ASTCtx(Ctx) {} - -ParentMapContext::~ParentMapContext() = default; - -void ParentMapContext::clear() { Parents.reset(); } - -const Expr *ParentMapContext::traverseIgnored(const Expr *E) const { - return traverseIgnored(const_cast<Expr *>(E)); -} - -Expr *ParentMapContext::traverseIgnored(Expr *E) const { - if (!E) - return nullptr; - - switch (Traversal) { - case TK_AsIs: - return E; - case TK_IgnoreUnlessSpelledInSource: - return E->IgnoreUnlessSpelledInSource(); - } - llvm_unreachable("Invalid Traversal type!"); -} - -DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const { - if (const auto *E = N.get<Expr>()) { - return DynTypedNode::create(*traverseIgnored(E)); - } - return N; -} - template <typename T, typename... U> static std::tuple<bool, DynTypedNodeList, const T *, const U *...> matchParents(const DynTypedNodeList &NodeList, @@ -334,6 +304,36 @@ matchParents(const DynTypedNodeList &NodeList, return MatchParents<T, U...>::match(NodeList, ParentMap); } +ParentMapContext::ParentMapContext(ASTContext &Ctx) : ASTCtx(Ctx) {} + +ParentMapContext::~ParentMapContext() = default; + +void ParentMapContext::clear() { Parents.reset(); } + +const Expr *ParentMapContext::traverseIgnored(const Expr *E) const { + return traverseIgnored(const_cast<Expr *>(E)); +} + +Expr *ParentMapContext::traverseIgnored(Expr *E) const { + if (!E) + return nullptr; + + switch (Traversal) { + case TK_AsIs: + return E; + case TK_IgnoreUnlessSpelledInSource: + return E->IgnoreUnlessSpelledInSource(); + } + llvm_unreachable("Invalid Traversal type!"); +} + +DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const { + if (const auto *E = N.get<Expr>()) { + return DynTypedNode::create(*traverseIgnored(E)); + } + return N; +} + /// Template specializations to abstract away from pointers and TypeLocs. /// @{ template <typename T> static DynTypedNode createDynTypedNode(const T &Node) { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
