[all-commits] [llvm/llvm-project] 6bdb15: [pseudo] Reorganize CXX.h enums

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Jul 27 00:04:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6bdb15fe844c428f1bf477c73a36901c84e5b5fa
      https://github.com/llvm/llvm-project/commit/6bdb15fe844c428f1bf477c73a36901c84e5b5fa
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M clang-tools-extra/pseudo/gen/Main.cpp
    M clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h
    M clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h
    M clang-tools-extra/pseudo/lib/cxx/CXX.cpp
    M clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
    M clang-tools-extra/pseudo/unittests/CMakeLists.txt
    A clang-tools-extra/pseudo/unittests/CXXTest.cpp
    M clang-tools-extra/pseudo/unittests/GrammarTest.cpp

  Log Message:
  -----------
  [pseudo] Reorganize CXX.h enums

- 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.

Differential Revision: https://reviews.llvm.org/D130414




More information about the All-commits mailing list