[PATCH] D90161: [SyntaxTree] Provide iterators for Lists

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 26 08:26:42 PDT 2020


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

Provide an iterator for `List` that iterates through elements and delimiters on pairs. This iterator is robust to missing elements. For instance, in the following function call:
`f(a b, , )`
The iterator would emit the following elements and delimiters:
`[("a", null), ("b", ","), (null, ","), (null, null) ]`

This iterator abstracts out many corner cases when dealing with lists, thus providing a cleaner interface for mutation and traversal of `List`s.

Note: This iterator has the memory footprint of one pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90161

Files:
  clang/include/clang/Tooling/Syntax/Tree.h
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/lib/Tooling/Syntax/Tree.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90161.300682.patch
Type: text/x-patch
Size: 25978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201026/a65bf692/attachment-0001.bin>


More information about the cfe-commits mailing list