Skip to content

Conversation

victorvianna
Copy link
Contributor

ParentMapContext::ParentMapContext(ASTContext &Ctx) instantiates ~unique_ptrParentMapContext::ParentMap, so it must be defined after that class is a complete type.

ParentMapContext::ParentMapContext(ASTContext &Ctx) instantiates
~unique_ptr<ParentMapContext::ParentMap>, so it must be defined
after that class is a complete type.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Oct 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2025

@llvm/pr-subscribers-clang

Author: Victor Vianna (victorvianna)

Changes

ParentMapContext::ParentMapContext(ASTContext &Ctx) instantiates ~unique_ptr<ParentMapContext::ParentMap>, so it must be defined after that class is a complete type.


Full diff: https://github.com/llvm/llvm-project/pull/163553.diff

1 Files Affected:

  • (modified) clang/lib/AST/ParentMapContext.cpp (+30-30)
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) {

@victorvianna
Copy link
Contributor Author

@cor3ntin could you merge this? I don't have permission

@cor3ntin cor3ntin merged commit 16dfd31 into llvm:main Oct 15, 2025
13 checks passed
hubot pushed a commit to google/angle that referenced this pull request Oct 15, 2025
https://chromium.googlesource.com/external/github.com/llvm/llvm-project/+log/fd9a1dcc01766c71932898e9643ce28bf2801bad..67790d3fb06b184b7be9c4d3e36ab01f0ac4198e

The goal is to roll these C++23 fixes [1][2][3][4].

[1] llvm/llvm-project#163555
[2] llvm/llvm-project#163554
[3] llvm/llvm-project#163545
[4] llvm/llvm-project#163553

Bug: chromium:388070065
Change-Id: I23cd9acdfffc9a532e16575a0d4d91a8da72b432
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/7045718
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Victor Vianna <victorvianna@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants