[all-commits] [llvm/llvm-project] 23657d: [SyntaxTree] Add reverse links to syntax Nodes.
Eduardo Caldas via All-commits
all-commits at lists.llvm.org
Thu Nov 5 01:54:37 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 23657d9cc33282208bdac074abccd73bd4d4f8be
https://github.com/llvm/llvm-project/commit/23657d9cc33282208bdac074abccd73bd4d4f8be
Author: Eduardo Caldas <ecaldas at google.com>
Date: 2020-11-05 (Thu, 05 Nov 2020)
Changed paths:
M clang/include/clang/Tooling/Syntax/Tree.h
M clang/lib/Tooling/Syntax/BuildTree.cpp
M clang/lib/Tooling/Syntax/Mutations.cpp
M clang/lib/Tooling/Syntax/Synthesis.cpp
M clang/lib/Tooling/Syntax/Tree.cpp
Log Message:
-----------
[SyntaxTree] Add reverse links to syntax Nodes.
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.
Differential Revision: https://reviews.llvm.org/D90240
More information about the All-commits
mailing list