23 assert(Anchor !=
nullptr);
24 assert(Anchor->Parent !=
nullptr);
25 assert(
New->Parent ==
nullptr);
26 assert(
New->NextSibling ==
nullptr);
27 assert(
New->PreviousSibling ==
nullptr);
28 assert(
New->isDetached());
32 auto *
P = Anchor->getParent();
33 P->replaceChildRangeLowLevel(Anchor->getNextSibling(),
34 Anchor->getNextSibling(),
New);
36 P->assertInvariants();
41 assert(Old !=
nullptr);
42 assert(Old->Parent !=
nullptr);
44 assert(
New->Parent ==
nullptr);
45 assert(
New->NextSibling ==
nullptr);
46 assert(
New->PreviousSibling ==
nullptr);
47 assert(
New->isDetached());
49 New->Role = Old->Role;
53 P->assertInvariants();
59 assert(N->Parent !=
nullptr);
66 P->assertInvariants();
74 assert(S->canModify());
76 if (isa<CompoundStatement>(S->getParent())) {
78 MutationsImpl::remove(S);
82 if (isa<EmptyStatement>(S))
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
A memory arena for syntax trees.
void assertInvariants() const
Asserts invariants on this node of the tree and its immediate children.
bool canModify() const
If this function return false, the tree cannot be modified because there is no reasonable way to prod...
const Node * getNextSibling() const
const Tree * getParent() const
An abstract node for C++ statements, e.g.
A TokenBuffer-powered token manager.
static void addAfter(syntax::Node *Anchor, syntax::Node *New, NodeRole Role)
Add a new node with a specified role.
static void remove(syntax::Node *N)
Completely remove the node from its parent.
static void replace(syntax::Node *Old, syntax::Node *New)
Replace the node, keeping the role.
NodeRole
A relation between a parent and child node, e.g.
@ Detached
A node without a parent.
syntax::EmptyStatement * createEmptyStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM)
void removeStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM, syntax::Statement *S)
Removes a statement or replaces it with an empty statement where one is required syntactically.
The JSON file list parser is used to communicate input to InstallAPI.