[PATCH] D88403: Migrate Declarators to use the List API

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 04:56:36 PDT 2020


eduucaldas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
eduucaldas requested review of this revision.

After this change all nodes that have a delimited-list are using the
`List` API.

Implementation details:
Let's look at a declaration with multiple declarators:
`int a, b;`
To generate a declarator list node we need to have the range of
declarators: `a, b`:
However, the `ClangAST` actually stores them as separate declarations:
`int a   ;`
`int    b;`
We solve that by appropriately marking the declarators on each separate
declaration in the `ClangAST` and then for the final declarator `int
b`, shrinking its range to fit to the already marked declarators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88403

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/lib/Tooling/Syntax/Synthesis.cpp
  clang/unittests/Tooling/Syntax/BuildTreeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88403.294661.patch
Type: text/x-patch
Size: 10301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200928/8fbcb6f6/attachment.bin>


More information about the cfe-commits mailing list