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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 29 00:39:18 PDT 2022


hokein created this revision.
hokein added reviewers: sammccall, usaxena95.
Herald added a project: All.
hokein requested review of this revision.
Herald added a subscriber: alextsao1999.
Herald added a project: clang-tools-extra.

See https://reviews.llvm.org/D130626 for details;

A prototype to eliminate "local" identifier ambiguties in the grammar:

- use a unified type-name instead, and remove all different type rules ( class-name/enum-name/typedef-name), this eliminates the top#1 type-name ambiguity;
- use a generic identifier for nested-name-specifier, and don't distinguish with the type-name and namespace-name cases;
- remove template-name rule, it is mainly used for the template argument deduction in simple-type-specifier, it has the same syntax with type-name, merged with type-name case;

After this patch, remaining ambiguities are real ambiguities in C++:
Some numbers with this patch:

| file                 | ambiguous nodes | forest size      | glrParse performance |
| SemaCodeComplete.cpp | 1.1w -> 2k      | 10.4MB -> 7.12MB | 7.1MB/s -> 11MB/s    |
| AST.cpp              | 1.3k -> 286     | 0.99MB -> 0.68MB | 6.7MB/s -> 9.9MB/s   |


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130747

Files:
  clang-tools-extra/pseudo/lib/cxx/CXX.cpp
  clang-tools-extra/pseudo/lib/cxx/cxx.bnf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130747.448535.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220729/0e7a8fee/attachment-0001.bin>


More information about the cfe-commits mailing list