[PATCH] D130626: [pseudo] experiment

2022-07-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. The solution in imperfect here (it is based on the identifier content, so it won't work if the code happen to have two same-content-but-different-kind tokens, e.g. `trace::Span Span;`), but it at least shows that ambiguities in identifiers are the most critical one.

[PATCH] D130626: [pseudo] experiment

2022-07-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. Herald added subscribers: usaxena95, kadircet. Herald added a project: All. hokein requested review of this revision. Herald added subscribers: cfe-commits, alextsao1999, ilya-biryukov. Herald added a project: clang-tools-extra. This is not the direction we will

[PATCH] D130511: [pseudo][wip] Eliminate simple-type-specifier ambiguities.

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. In D130511#3679161 , @sammccall wrote: > TL;DR: I suspect this is valid but guarding `nested-name-specifier := :: > [guard=PrevNotIdentifier]` may be equivalent and clearer. Yeah, that's better! Repository: rG LLVM Github

[PATCH] D130511: [pseudo][wip] Eliminate simple-type-specifier ambiguities.

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 447815. hokein added a comment. refine the patch: guard the "::" nested-name-specifier rule instead. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130511/new/ https://reviews.llvm.org/D130511 Files:

[PATCH] D130591: [pseudo] Use the TokenIndex for the lookahead in GuardParams

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a subscriber: arphaman. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. Repository: rG LLVM Github Monorepo

[PATCH] D130414: [pseudo] Reorganize CXX.h enums

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. I think this patch is in a good state. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h:54 +namespace rules { +namespace dummy { +enum Rule {

[PATCH] D130550: [pseudo] Start rules are `_ := start-symbol EOF`, improve recovery.

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. +1 on this change, it would make the expose-lookahead-index-to-guard change easier. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:74 bool GCParity; +// Have we already used this node for error recovery? (prevents loops) +

[PATCH] D130414: [pseudo] Reorganize CXX.h enums

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h:54 +namespace rules { +namespace dummy { +enum Rule { usaxena95 wrote: > sammccall wrote: > > hokein wrote: > > > why there is a dummy namespace here? > > for each

[PATCH] D130551: [pseudo] Allow opaque nodes to represent terminals

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. The change looks good, are you planning to use it in the cxx.bnf? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130551/new/

[PATCH] D130511: [pseudo][wip] Eliminate simple-type-specifier ambiguities.

2022-07-26 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. In D130511#3677423 , @sammccall wrote: > My main concern here is that this might reject valid code (and if it doesn't, > it's not obvious why). > It does look like C++ forbids the cases I can come up with (e.g. trying to >

[PATCH] D130511: [pseudo][wip] Eliminate simple-type-specifier ambiguities.

2022-07-25 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. The solution is to favor the longest possible nest-name-specifier, and drop

[PATCH] D130337: [pseudo] Eliminate multiple-specified-types ambiguities using guards

2022-07-25 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Feel free to land it. We have some number now. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130337/new/ https://reviews.llvm.org/D130337 ___ cfe-commits mailing list

[PATCH] D130414: [pseudo] Reorganize CXX.h enums

2022-07-25 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Thanks for exploring the idea, this looks like a good start to me. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h:54 +namespace rules { +namespace dummy { +enum Rule { why there is a dummy namespace here?

[PATCH] D130337: [pseudo] Eliminate multiple-specified-types ambiguities using guards

2022-07-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. The change looks good to me. In D130337#3671575 , @sammccall wrote: > LMK if anything else blocking here. I don't want to block you, but I'd suggest postponing it a little bit until we collect some metrics in our internal

[PATCH] D130337: [pseudo] Eliminate multiple-specified-types ambiguities using guards

2022-07-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Thanks, the change looks good in general. > we handle *all* rules for the interesting node types explicitly, rather than > default: return false. This allows us to assert that all cases are handled, > so things don't "fall through the cracks" after grammar changes.

[PATCH] D130160: [pseudo] Eliminate the dangling-else syntax ambiguity.

2022-07-22 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG2a88fb2ecb72: [pseudo] Eliminate the dangling-else syntax ambiguity. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D130160: [pseudo] Eliminate the dangling-else syntax ambiguity.

2022-07-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 446728. hokein added a comment. rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130160/new/ https://reviews.llvm.org/D130160 Files: clang-tools-extra/pseudo/include/clang-pseudo/Language.h

[PATCH] D130081: Add foldings for multi-line comment.

2022-07-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/clangd/Protocol.h:1782 unsigned endCharacter; - std::string kind; + FoldingRangeKind kind; }; sorry for not being clear on my previous comment, I think the current `string kind;` is good, and it

[PATCH] D130160: [pseudo] Eliminate the dangling-else syntax ambiguity.

2022-07-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/Language.h:25 + const TokenStream + SymbolID Lookahead; +}; sammccall wrote: > passing the position in the stream would be more general, there's no reason > in particular

[PATCH] D130160: [pseudo] Eliminate the dangling-else syntax ambiguity.

2022-07-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 446388. hokein marked 2 inline comments as done. hokein added a comment. address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130160/new/ https://reviews.llvm.org/D130160 Files:

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. I'm sorry for the trouble it causes, and thanks for all details! > This could have something to do with "LLVM_OPTIMIZED_TABLEGEN": "ON", > perhaps, and there is some dependency missing to rebuild the NATIVE target. Yeah, the native clang-pseudo-gen tool didn't rebuild

[PATCH] D130160: [pseudo] Eliminate the dangling-else syntax ambiguity.

2022-07-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: usaxena95. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. - the grammar ambiguity is eliminate by a guard; - modify the guard function

[PATCH] D130066: [pseudo] Key guards by RuleID, add guards to literals (and 0).

2022-07-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. it looks good. Comment at: clang-tools-extra/pseudo/gen/Main.cpp:102 llvm::StringRef Name = G.table().AttributeValues[EID]; - assert(!Name.empty());

[PATCH] D130011: Use pseudoparser-based folding ranges in ClangdServer.

2022-07-19 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. The change looks good to me. > as discussed offline i don't see much value in having an extra flag to choose > between ast-based and pseudo-based implementation, as the pseudo-based one is >

[PATCH] D130081: Add foldings for multi-line comment.

2022-07-19 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:176 // FIXME(kirillbobyrev): Collect comments, PP conditional regions, includes and // other code regions (e.g. public/private/protected sections of classes, nit: update

[PATCH] D130004: [pseudo] Add `clang-pseudo -html-forest=`, an HTML forest browser

2022-07-19 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Super cool! Can't wait to use it. The code looks good, just nits (feel free to ignore) Comment at: clang-tools-extra/pseudo/tool/CMakeLists.txt:29

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-19 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGd489b3807f09: [pseudo] Implement a guard to determine function declarator. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-19 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 445714. hokein marked 3 inline comments as done. hokein added a comment. restore the previous and simplified function-declarator test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129222/new/

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. All comments should be addressed now. As discussed offline, I'm going to land it now, happy to address any post comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129222/new/ https://reviews.llvm.org/D129222

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 445427. hokein marked 3 inline comments as done. hokein added a comment. rebase and add comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129222/new/ https://reviews.llvm.org/D129222 Files:

[PATCH] D129648: Use pseudo parser for folding ranges

2022-07-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Thanks, this looks good. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129648/new/ https://reviews.llvm.org/D129648

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 444976. hokein added a comment. rebase and address the main comment -- encoding the function-declarator into the grammar. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129222/new/

[PATCH] D125311: [pseudo] Share the underly payload when stripping comments for a token stream

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG76910d4a56c8: [pseudo] Share the underly payload when stripping comments for a token stream (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D129359: [pseudo] Generate an enum type for identifying grammar rules.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG231535890655: [pseudo] Generate an enum type for identifying grammar rules. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D129359: [pseudo] Generate an enum type for identifying grammar rules.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h:172 + // terminal `,` becomes `comma`; + // terminal `INT` becomes `int`; + std::string mangleSymbol(SymbolID) const; sammccall wrote: > I hope you

[PATCH] D129359: [pseudo] Generate an enum type for identifying grammar rules.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 444956. hokein marked 2 inline comments as done. hokein added a comment. update. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129359/new/ https://reviews.llvm.org/D129359 Files:

[PATCH] D129648: Use pseudo parser for folding ranges

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:175 + + llvm::Optional Preprocessed; + Preprocessed = DirectiveStructure.stripDirectives(OrigStream); nit: no need to use llvm::Optional. Comment at:

[PATCH] D128411: [syntax] Introduce a TokenManager interface.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. In D128411#3654452 , @DavidSpickett wrote: > FYI, after this change I get: > > > /home/david.spickett/llvm-project/clang/include/clang/Tooling/Syntax/TokenBufferTokenManager.h:20:7: > warning:

[PATCH] D128411: [syntax] Introduce a TokenManager interface.

2022-07-15 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG263dcf452fa0: [syntax] Introduce a TokenManager interface. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D128411: [syntax] Introduce a TokenManager interface.

2022-07-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 444244. hokein added a comment. Herald added subscribers: kadircet, arphaman. Herald added a project: clang-tools-extra. update the API changes in clangd part. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D129579: [clangd] Remove `allCommitCharacters`

2022-07-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:537 llvm::json::Object{ - {"allCommitCharacters", -{" ", "\t", "(", ")", "[", "]",

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

2022-07-12 Thread Haojian Wu via Phabricator via cfe-commits
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

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

2022-07-11 Thread Haojian Wu via Phabricator via cfe-commits
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

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

2022-07-11 Thread Haojian Wu via Phabricator via cfe-commits
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

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

2022-07-11 Thread Haojian Wu via Phabricator via cfe-commits
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:

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/gen/Main.cpp:114 + const clang::pseudo::Rule = G.table().Rules[RID]; + // lhs$$rhs$rhs$rhs + std::string EnumName = symbolName(R.Target, G) + "$"; sammccall wrote: > hokein wrote:

[PATCH] D129359: [pseudo] Generate an enum type for identifying grammar rules.

2022-07-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. The Rule enum type enables us to identify a grammar rule within C++'s type

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

2022-07-08 Thread Haojian Wu via Phabricator via cfe-commits
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 >

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

2022-07-08 Thread Haojian Wu via Phabricator via cfe-commits
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/

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/gen/Main.cpp:114 + const clang::pseudo::Rule = G.table().Rules[RID]; + // lhs$$rhs$rhs$rhs + std::string EnumName = symbolName(R.Target, G) + "$"; sammccall wrote: > so the dollar

[PATCH] D129222: [pseudo] Implement a guard to determine function declarator.

2022-07-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. - emit an enum type to identify each grammar rule (in lhs$$rhs$rhs$ form); -

[PATCH] D129158: [pseudo] Define recovery strategy as grammar extension.

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/lib/cxx/CXX.cpp:46 + assert(Begin > 0); + const Token = Tokens.tokens()[Begin - 1]; + if (const Token *Right = Left.pair())

[PATCH] D128486: [pseudo] Add error-recovery framework & brace-based recovery

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Looks great, let's ship it! feel free to land it in any form you think it is suitable. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:150 +// OldHeads is

[PATCH] D127448: [pseudo] Implement guard extension.

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG9ab67cc8bfe7: [pseudo] Implement guard extension. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D127448: [pseudo] Implement guard extension.

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 442290. hokein marked 5 inline comments as done. hokein added a comment. address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127448/new/ https://reviews.llvm.org/D127448 Files:

[PATCH] D129074: [pseudo] Use the prebuilt cxx grammar for the lit tests, NFC.

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG70c0d92930b2: [pseudo] Use the prebuilt cxx grammar for the lit tests, NFC. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129074/new/

[PATCH] D129093: [pseudo] Eliminate LRTable::Action. NFC

2022-07-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h:84 - - // NOTE: there are no typical accept actions in the LRtable, accept - //

[PATCH] D129074: [pseudo] Use the prebuilt cxx grammar for the lit tests, NFC.

2022-07-04 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. In D129074#3628221 , @sammccall wrote: > Can we make this the default value of the flag instead? Yeah, the default one is the `cxx`. But I found it is a bit clearer to explicitly mention it in the code. (also happy to remove all

[PATCH] D128485: [pseudo] Store shift and goto actions in a compact structure with faster lookup.

2022-07-04 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h:72 // action types, this class becomes less useful. Remove it. class Action {

[PATCH] D129074: [pseudo] Use the prebuilt cxx grammar for the lit tests, NFC.

2022-07-04 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D129074

[PATCH] D128472: [pseudo] Check follow-sets instead of tying reduce actions to lookahead tokens.

2022-07-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Thanks for the report. There is an out-of-bound issue in LRTable::getReduceRules, fixed in c99827349927a44334f2b04139168efd0bc87cd3 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D127448: [wip][pseudo] Implement guard extension.

2022-07-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:298 auto Pop = [&](const GSS::Node *Head, RuleID RID) { -LLVM_DEBUG(llvm::dbgs() << " Pop " << Params.G.dumpRule(RID) << "\n"); -const auto = Params.G.lookupRule(RID); +

[PATCH] D127448: [wip][pseudo] Implement guard extension.

2022-07-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 441680. hokein marked 5 inline comments as done. hokein added a comment. fix format. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127448/new/ https://reviews.llvm.org/D127448 Files:

[PATCH] D127448: [wip][pseudo] Implement guard extension.

2022-07-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 441677. hokein marked 8 inline comments as done. hokein added a comment. rebase and address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127448/new/ https://reviews.llvm.org/D127448 Files:

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-07-01 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGfe66aebd7551: [pseudo] Define a clangPseudoCLI library. (authored by hokein). Changed prior to commit:

[PATCH] D128930: [pseudo] Add ForestNode descendants iterator, print ambiguous/opaque node stats.

2022-06-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Nice! Comment at: clang-tools-extra/pseudo/tool/ClangPseudo.cpp:68 + +struct NodeStats { + unsigned Total = 0; I can foresee we will use it in other places

[PATCH] D128795: [pseudo] Reimplement hardcoded error handling as a recovery strategy. NFC

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h:89 // FIXME: these should be provided as extensions instead. -enum class RecoveryStrategy :

[PATCH] D128805: [pseudo] Fix bugs/inconsistencies in forest dump.

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/unittests/ForestTest.cpp:138 + + const auto *B = (symbol("B"), ruleFor("B"), {Star}); + const auto *A1 = (symbol("A"),

[PATCH] D128812: [pseudo] prototype build syntax-tree from the parse forest.

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. Herald added a subscriber: mgorny. Herald added a project: All. hokein requested review of this revision. Herald added subscribers: cfe-commits, alextsao1999. Herald added projects: clang, clang-tools-extra. WARNING: this is an extremely-hacked prototype.

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/benchmarks/Benchmark.cpp:51 const std::string *SourceText = nullptr; -const Grammar *G = nullptr; +const Language *PLang = nullptr; sammccall wrote: > nit: still PLang here and in a bunch of

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 440929. hokein marked an inline comment as done. hokein added a comment. address review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128679/new/ https://reviews.llvm.org/D128679 Files:

[PATCH] D128486: [pseudo] Add error-recovery framework & brace-based recovery

2022-06-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. the patch looks a good start to me, some initial comments (mostly around the recovery part). Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:150 +// OldHeads is the parse state at TokenIndex. +// This function consumes consumes zero or

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:115 // Parameters for the GLR parsing. +// FIXME: refine it with the ParseLang struct. struct ParseParams { sammccall wrote: > You're already touching the callsites

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 440765. hokein marked an inline comment as done. hokein added a comment. address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128679/new/ https://reviews.llvm.org/D128679 Files:

[PATCH] D128687: [pseudo] Allow mixed designated/undesignated init lists.

2022-06-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/lib/cxx.bnf:468 designator := . IDENTIFIER +designator := [ expression ] expr-or-braced-init-list := expression I

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 440366. hokein added a comment. remove a dependency from pseudoCLI lib Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128679/new/ https://reviews.llvm.org/D128679 Files:

[PATCH] D128679: [pseudo] Define a clangPseudoCLI library.

2022-06-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a subscriber: mgorny. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. - define a common data structure

[PATCH] D128472: [pseudo] Check follow-sets instead of tying reduce actions to lookahead tokens.

2022-06-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. This looks a great improvement. A few nits, it looks good to me overall. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h:136 + // check whether

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

2022-06-24 Thread Haojian Wu via Phabricator via cfe-commits
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

[PATCH] D128511: [clang-tidy] Make the cert/uppercase-literal-suffix-integer fully hermetic.

2022-06-24 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG9081d3d8097a: [clang-tidy] Make the cert/uppercase-literal-suffix-integer fully hermetic. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2022-06-24 Thread Haojian Wu via Phabricator via cfe-commits
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/

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

2022-06-24 Thread Haojian Wu via Phabricator via cfe-commits
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

[PATCH] D128511: [clang-tidy] Make the cert/uppercase-literal-suffix-integer fully hermetic.

2022-06-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added reviewers: LegalizeAdulthood, aaron.ballman. Herald added a subscriber: xazax.hun. Herald added a project: All. hokein requested review of this revision. Herald added a project: clang-tools-extra. after the test-reorg commit

[PATCH] D128299: [pseudo] Add a fast-path to GLR reduce when both pop and push are trivial

2022-06-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:268 + // However in trivial cases (only pop that yields only one push) we can + // bypass all these fancy queues and pop+push directly. This is very common. + auto PopAndPushTrivial = [&]() -> bool

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

2022-06-23 Thread Haojian Wu via Phabricator via cfe-commits
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

[PATCH] D128307: [pseudo] Store reduction sequences by pointer in heaps, instead of by value.

2022-06-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:208 + // Underlying storage for sequences pointed to by stored SequenceRefs. + std::deque SequenceStorage; + // We

[PATCH] D128299: [pseudo] Add a fast-path to GLR reduce when both pop and push are trivial

2022-06-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:269 + // bypass all these fancy queues and pop+push directly. This is very common. + auto PopAndPushTrivial = [&]() ->

[PATCH] D128297: [pseudo] Track heads as GSS nodes, rather than as "pending actions".

2022-06-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Thanks, this looks a reasonable change to me. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:140 + const ForestNode , const ParseParams , + std::vector ); +// Applies available reductions on Heads, appending

[PATCH] D127448: [wip][pseudo] Implement guard extension.

2022-06-10 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 435889. hokein added a comment. - add comments; - add unittest and lit test; - misc improvements; Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127448/new/ https://reviews.llvm.org/D127448 Files:

[PATCH] D127448: [wip][pseudo] Implement guard extension.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a subscriber: mgorny. Herald added a project: All. hokein requested review of this revision. Herald added subscribers: cfe-commits, alextsao1999. Herald added a project: clang-tools-extra. - define a common data

[PATCH] D127388: [pseudo] Move grammar-related headers to a separate dir, NFC.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc70aeaad2b23: [pseudo] Move grammar-related headers to a separate dir, NFC. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D127388: [pseudo] Move grammar-related headers to a separate dir, NFC.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h:52 #ifndef CLANG_PSEUDO_GRAMMAR_H #define CLANG_PSEUDO_GRAMMAR_H sammccall wrote: > header guards should really be updated :-( oops, forgot these.

[PATCH] D127388: [pseudo] Move grammar-related headers to a separate dir, NFC.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 435516. hokein added a comment. update header guards. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127388/new/ https://reviews.llvm.org/D127388 Files: clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp

[PATCH] D127400: [pseudo] Add xfail tests for a simple-declaration/function-definition ambiguity

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/pseudo/test/cxx/declarator-function.cpp:12 +// CHECK: function-definition := decl-specifier-seq declarator +// function-body

[PATCH] D127397: [pseudo] Fix unit test build

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. In D127397#3569925 , @ckandeler wrote: > Can you please merge it? I don't have the rights. sure, committed in bf830623b063af1c620f369b6bf1808c30d5f0fb .

[PATCH] D127397: [pseudo] Fix unit test build

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGbf830623b063: [pseudo] Fix unit test build (authored by ckandeler, committed by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127397/new/

[PATCH] D127397: [pseudo] Fix unit test build

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127397/new/ https://reviews.llvm.org/D127397

[PATCH] D126536: [pseudo] Add grammar annotations support.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/pseudo/lib/grammar/GrammarBNF.cpp:235 Out.Sequence.push_back({Chunk}); } uabelho wrote: > I get a warning/error on this line with this commit: > ``` > 13:31:17

[PATCH] D127388: [pseudo] Move grammar-related headers to a separate dir, NFC.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 435483. hokein added a comment. update missing files. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127388/new/ https://reviews.llvm.org/D127388 Files: clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp

[PATCH] D127388: [pseudo] Move grammar-related headers to a separate dir, NFC.

2022-06-09 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra. We did that for .cpp, but forgot the headers. Repository: rG LLVM Github

<    3   4   5   6   7   8   9   10   11   12   >