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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 23 00:55:43 PDT 2022


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

- Place rules under rule::lhs::rhs__rhs__rhs
- Change mangling of keywords to ALL_CAPS (needed to turn keywords that appear alone on RHS into valid identifiers)
- Make enums implicitly convertible to underlying type (though still scoped, using alias tricks)

In principle this lets us exhaustively write a switch over all rules of a NT:

  switch ((rule::declarator)N->rule()) {
    case rule::declarator::noptr_declarator:
      ...
  }

In practice we don't do this anywhere yet as we're often switching over multiple
nonterminal kinds at once.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130414

Files:
  clang-tools-extra/pseudo/gen/Main.cpp
  clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h
  clang-tools-extra/pseudo/lib/cxx/CXX.cpp
  clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
  clang-tools-extra/pseudo/unittests/GrammarTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130414.447044.patch
Type: text/x-patch
Size: 15251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220723/3893420d/attachment.bin>


More information about the cfe-commits mailing list