[all-commits] [llvm/llvm-project] 5011d4: Migrate Declarators to use the List API

Eduardo Caldas via All-commits all-commits at lists.llvm.org
Thu Oct 1 06:57:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5011d43108d1de30a056d66e73fa19062e0e84b7
      https://github.com/llvm/llvm-project/commit/5011d43108d1de30a056d66e73fa19062e0e84b7
  Author: Eduardo Caldas <ecaldas at google.com>
  Date:   2020-10-01 (Thu, 01 Oct 2020)

  Changed paths:
    M clang/include/clang/Tooling/Syntax/Nodes.h
    M clang/lib/Tooling/Syntax/BuildTree.cpp
    M clang/lib/Tooling/Syntax/Nodes.cpp
    M clang/lib/Tooling/Syntax/Synthesis.cpp
    M clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
    M clang/unittests/Tooling/Syntax/SynthesisTest.cpp

  Log Message:
  -----------
  Migrate Declarators to use the List API

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.

Differential Revision: https://reviews.llvm.org/D88403




More information about the All-commits mailing list