Skip to content

Commit 16dfd31

Browse files
victorviannaVictor Hugo Vianna Silva
andauthored
[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]>
1 parent e938e02 commit 16dfd31

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

clang/lib/AST/ParentMapContext.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,6 @@
2020

2121
using namespace clang;
2222

23-
ParentMapContext::ParentMapContext(ASTContext &Ctx) : ASTCtx(Ctx) {}
24-
25-
ParentMapContext::~ParentMapContext() = default;
26-
27-
void ParentMapContext::clear() { Parents.reset(); }
28-
29-
const Expr *ParentMapContext::traverseIgnored(const Expr *E) const {
30-
return traverseIgnored(const_cast<Expr *>(E));
31-
}
32-
33-
Expr *ParentMapContext::traverseIgnored(Expr *E) const {
34-
if (!E)
35-
return nullptr;
36-
37-
switch (Traversal) {
38-
case TK_AsIs:
39-
return E;
40-
case TK_IgnoreUnlessSpelledInSource:
41-
return E->IgnoreUnlessSpelledInSource();
42-
}
43-
llvm_unreachable("Invalid Traversal type!");
44-
}
45-
46-
DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const {
47-
if (const auto *E = N.get<Expr>()) {
48-
return DynTypedNode::create(*traverseIgnored(E));
49-
}
50-
return N;
51-
}
52-
5323
template <typename T, typename... U>
5424
static std::tuple<bool, DynTypedNodeList, const T *, const U *...>
5525
matchParents(const DynTypedNodeList &NodeList,
@@ -334,6 +304,36 @@ matchParents(const DynTypedNodeList &NodeList,
334304
return MatchParents<T, U...>::match(NodeList, ParentMap);
335305
}
336306

307+
ParentMapContext::ParentMapContext(ASTContext &Ctx) : ASTCtx(Ctx) {}
308+
309+
ParentMapContext::~ParentMapContext() = default;
310+
311+
void ParentMapContext::clear() { Parents.reset(); }
312+
313+
const Expr *ParentMapContext::traverseIgnored(const Expr *E) const {
314+
return traverseIgnored(const_cast<Expr *>(E));
315+
}
316+
317+
Expr *ParentMapContext::traverseIgnored(Expr *E) const {
318+
if (!E)
319+
return nullptr;
320+
321+
switch (Traversal) {
322+
case TK_AsIs:
323+
return E;
324+
case TK_IgnoreUnlessSpelledInSource:
325+
return E->IgnoreUnlessSpelledInSource();
326+
}
327+
llvm_unreachable("Invalid Traversal type!");
328+
}
329+
330+
DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const {
331+
if (const auto *E = N.get<Expr>()) {
332+
return DynTypedNode::create(*traverseIgnored(E));
333+
}
334+
return N;
335+
}
336+
337337
/// Template specializations to abstract away from pointers and TypeLocs.
338338
/// @{
339339
template <typename T> static DynTypedNode createDynTypedNode(const T &Node) {

0 commit comments

Comments
 (0)