[PATCH] D130747: [pseudo] wip/prototype: eliminate identifier ambiguities in the grammar.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 17 04:35:30 PDT 2022


hokein added a comment.

In D130747#3727386 <https://reviews.llvm.org/D130747#3727386>, @sammccall wrote:

> LG, though i think we should eliminate class-name altogether.
>
> This gives most of the perf, which is nice!
>
> The reduction in ambiguous nodes is less impressive than before :-( As discussed offline, i think the remaining ambiguous nodes serve a purpose as they will assist in correlated disambiguation & keep the representation of important concepts uniform. I may be wrong about that, in which case we can still drop them later.

Yeah, this is because we still keep two critical ambiguous nodes:

- simple-type-specifier (type-name vs template-name), e.g. for the CTAD case;
- nested-name-specifier (type-name vs namespace-name), e.g. for `a::b::c` case;

These two ambiguous nodes are the top1 and top2 now.

> The forest size reduction is nice to have, but least critical imo.





================
Comment at: clang-tools-extra/pseudo/lib/cxx/cxx.bnf:39
 namespace-name := IDENTIFIER
-namespace-name := namespace-alias
-namespace-alias := IDENTIFIER
 class-name := IDENTIFIER
 class-name := simple-template-id
----------------
sammccall wrote:
> hokein wrote:
> > this can be removed as well, but the `class-head-name` rule uses it. 
> Can't we use `class-head-name := nested-name-specifier_opt type-name` as `class-name` and `type-name` now match?
> 
> (Oops, not sure how i lost this comment)
ah, this is clever, I missed that the fact that class-name and type-name are identical now. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130747



More information about the cfe-commits mailing list