[PATCH] D128411: [syntax] Introduce a BaseToken class.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 05:04:04 PDT 2022


hokein updated this revision to Diff 439705.
hokein added a comment.

Revised to the TokenManager approach:

- Inroduce a Base Token class (TokenManager) for syntax-tree, the motivation is to allow using different underlying token implementation in syntax-tree
- Decouple the syntax-tree from the TokenBuffer:
  - syntax-tree structure (Tree.h) doesn't depend on the TokenBuffer, SourceManager Source location etc, it communicates with TokenManager interfaces;
  - syntax-tree Arena is simpler, the token-managing responsiblity is transferred to TokenManager;
  - in SyntaxTree directory, we implement a TokenBuffer-based SyntaxTokenManager, which mangues all token-related stuff
  - For the mutation/replacement computation APIs, currently they only work on a TokenBuffer-based token manager. Asssertion will be raised if it is not satisfied. It is an NFC change


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128411/new/

https://reviews.llvm.org/D128411

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/include/clang/Tooling/Syntax/TokenManager.h
  clang/include/clang/Tooling/Syntax/Tokens.h
  clang/include/clang/Tooling/Syntax/Tree.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/ComputeReplacements.cpp
  clang/lib/Tooling/Syntax/Synthesis.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp
  clang/lib/Tooling/Syntax/Tree.cpp
  clang/tools/clang-check/ClangCheck.cpp
  clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
  clang/unittests/Tooling/Syntax/SynthesisTest.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp
  clang/unittests/Tooling/Syntax/TreeTestBase.cpp
  clang/unittests/Tooling/Syntax/TreeTestBase.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128411.439705.patch
Type: text/x-patch
Size: 34061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220624/d648f704/attachment-0001.bin>


More information about the cfe-commits mailing list