[PATCH] D90240: [SyntaxTree] Add reverse links to syntax Nodes.
Eduardo Caldas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 27 08:27:28 PDT 2020
eduucaldas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
eduucaldas requested review of this revision.
Rationale:
Children of a syntax tree had forward links only, because there was no
need for reverse links.
This need appeared when we started mutating the syntax tree.
On a forward list, to remove a target node in O(1) we need a pointer to the node before the target. If we don't have this "before" pointer, we have to find it, and that requires O(n).
So in order to remove a syntax node from a tree, we would similarly need to find the node before to then remove. This is both not ergonomic nor does it have a good complexity.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D90240
Files:
clang/include/clang/Tooling/Syntax/Tree.h
clang/lib/Tooling/Syntax/Mutations.cpp
clang/lib/Tooling/Syntax/Tree.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90240.301004.patch
Type: text/x-patch
Size: 6438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201027/1693f6fd/attachment.bin>
More information about the cfe-commits
mailing list