summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Syntax/Tree.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing `;`. NFC.Michael Liao2020-01-141-1/+1
|
* [Syntax] Unset IsOriginal flag on nodes removed from the treeIlya Biryukov2020-01-141-8/+19
| | | | | | And add a corresponding test. Only nodes inside the TranslationUnit subtree can be marked as original, computeReplacements() relies on this.
* [Syntax] Assert invariants on tree structure and fix a bug in mutationsIlya Biryukov2020-01-141-2/+30
| | | | | | | | Add checks for some structural invariants when building and mutating the syntax trees. Fix a bug failing the invariants after mutations: the parent of nodes added into the tree was null.
* [Syntax] Allow to mutate syntax treesIlya Biryukov2019-12-181-3/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds facilities to mutate the syntax trees and produce corresponding text replacements. The public interface of the syntax library now includes facilities to: 1. perform type-safe modifications of syntax trees, 2. compute textual replacements to apply the modifications, 3. create syntax trees not backed by the source code. For each of the three, we only add a few example transformations in this patch to illustrate the idea, support for more kinds of nodes and transformations will be done in follow-up patches. The high-level mutation operations are implemented on top of operations that allow to arbitrarily change the trees. They are considered to be implementation details and are not available to the users of the library. Reviewers: sammccall, gribozavr2 Reviewed By: gribozavr2 Subscribers: merge_guards_bot, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64573
* [Syntax] Add nodes for most common statementsIlya Biryukov2019-11-061-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most of the statements mirror the ones provided by clang AST. Major differences are: - expressions are wrapped into 'ExpressionStatement' instead of being a subclass of statement, - semicolons are always consumed by the leaf expressions (return, expression satement, etc), - some clang statements are not handled yet, we wrap those into an UnknownStatement class, which is not present in clang. We also define an 'Expression' and 'UnknownExpression' classes in order to produce 'ExpressionStatement' where needed. The actual implementation of expressions is not yet ready, it will follow later. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63835
* [Syntax] Move roles into a separate enumIlya Biryukov2019-07-091-6/+10
| | | | | | To align with reviewer's suggestions. llvm-svn: 365479
* Reland r365355: [Syntax] Introduce syntax treesIlya Biryukov2019-07-091-0/+145
| | | | | | With a fix to a PS4 buildbot crash. llvm-svn: 365466
* Revert rL365355 : [Syntax] Introduce syntax treesSimon Pilgrim2019-07-091-145/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A tooling-focused alternative to the AST. This commit focuses on the memory-management strategy and the structure of the AST. More to follow later: - Operations to mutate the syntax trees and corresponding textual replacements. - Mapping between clang AST nodes and syntax tree nodes. - More node types corresponding to the language constructs. Reviewers: sammccall Reviewed By: sammccall Subscribers: llvm-commits, mgorny, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61637 ........ Fixes buildbots which were crashing on SyntaxTests.exe llvm-svn: 365465
* [Syntax] Introduce syntax treesIlya Biryukov2019-07-081-0/+145
Summary: A tooling-focused alternative to the AST. This commit focuses on the memory-management strategy and the structure of the AST. More to follow later: - Operations to mutate the syntax trees and corresponding textual replacements. - Mapping between clang AST nodes and syntax tree nodes. - More node types corresponding to the language constructs. Reviewers: sammccall Reviewed By: sammccall Subscribers: llvm-commits, mgorny, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61637 llvm-svn: 365355
OpenPOWER on IntegriCloud