hokein updated this revision to Diff 443922.
hokein added a comment.
remove all TokenBufferTokenManager cast usage, make it as a contract in the
APIs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128411/new/
https://reviews.llvm.org/D128411
File
sammccall added inline comments.
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:370
+ TreeBuilder(syntax::Arena &Arena)
+ : Arena(Arena), STM(cast(Arena.getTokenManager())),
+Pending(Arena, STM.tokenBuffer()) {
hokein wrote:
> sammccall wrote:
>
hokein added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/SyntaxTokenManager.h:20
+/// It tracks the underlying token buffers, source manager, etc.
+class SyntaxTokenManager : public TokenManager {
+public:
sammccall wrote:
> I don't think "syn
hokein updated this revision to Diff 443737.
hokein added a comment.
more update
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/Mutations.h
clang/include/cla
hokein updated this revision to Diff 443736.
hokein marked 7 inline comments as done.
hokein added a comment.
address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128411/new/
https://reviews.llvm.org/D128411
Files:
clang/include/clang
sammccall added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:24
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Token.h"
I think Token and TokenKinds are also no longer needed?
Comment at: clang/include/cl
hokein added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/TokenManager.h:37
+
+ // FIXME: add an interface for getting token kind.
+};
sammccall wrote:
> I wouldn't want to prejudge this: this is a very basic attribute similar to
> kind/role,
hokein updated this revision to Diff 443173.
hokein marked 9 inline comments as done.
hokein added a comment.
Herald added a subscriber: mgorny.
address review comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128411/new/
https://reviews.llvm
ilya-biryukov added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:463
+/// It tracks the underlying token buffers, source manager, etc.
+class SyntaxTokenManager : public TokenManager {
+public:
sammccall wrote:
> conceptually this is j
sammccall added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/TokenManager.h:9
+//
+// Defines Token interfaces for the syntax-tree, decoupling the syntax-tree
from
+// the TokenBuffer. It enables producers (e.g. clang pseudoparser) to produce a
---
ilya-biryukov added inline comments.
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:569
struct Forest {
-Forest(syntax::Arena &A) {
- assert(!A.getTokenBuffer().expandedTokens().empty());
- assert(A.getTokenBuffer().expandedTokens().back().kind() == tok::eof)
hokein added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/TokenManager.h:33
+ /// The syntax-tree Leaf node holds a Key.
+ using Key = const void *;
+ /// Gets the text of token identified by the key.
ilya-biryukov wrote:
> I have just reali
ilya-biryukov added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/TokenManager.h:33
+ /// The syntax-tree Leaf node holds a Key.
+ using Key = const void *;
+ /// Gets the text of token identified by the key.
I have just realized that we were
ilya-biryukov added inline comments.
Comment at: clang/include/clang/Tooling/Syntax/TokenManager.h:23
+
+/// Base token interfaces for the syntax-tree.
+class TokenManager {
NIT: maybe explain the `TokenManager` concept here, the comment seems to be a
leftover f
hokein added a comment.
I'm quite happy about the interfaces now, it should be in a good shape for the
API review (would be nice to get some initial feedback before I do further
cleanup).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128411/new/
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 T
sammccall added a comment.
As discussed offline this has some problems:
- putting virtual methods on BaseToken gives it a vtable, which makes it (and
syntax::Token) large
- being able to use ArrayRef but not ArrayRef is a
bit weird
- unusual uses of inheritance can be hard to reason about
We s
hokein created this revision.
hokein added reviewers: sammccall, ilya-biryukov.
Herald added a project: All.
hokein requested review of this revision.
Herald added a project: clang.
This enables us to use a different underlying token implementation for the
syntax Leaf node -- in clang pseudoparser
18 matches
Mail list logo