[all-commits] [llvm/llvm-project] 3132e9: [pseudo] Key guards by RuleID, add guards to liter...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Jul 21 13:42:48 PDT 2022


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

  Changed paths:
    M clang-tools-extra/pseudo/include/clang-pseudo/Language.h
    M clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h
    M clang-tools-extra/pseudo/lib/GLR.cpp
    M clang-tools-extra/pseudo/lib/cxx/CXX.cpp
    M clang-tools-extra/pseudo/lib/cxx/cxx.bnf
    M clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
    M clang-tools-extra/pseudo/lib/grammar/GrammarBNF.cpp
    A clang-tools-extra/pseudo/test/cxx/literals.cpp
    M clang-tools-extra/pseudo/test/cxx/mixed-designator.cpp
    M clang-tools-extra/pseudo/tool/ClangPseudo.cpp
    M clang-tools-extra/pseudo/unittests/GLRTest.cpp
    M clang-tools-extra/pseudo/unittests/GrammarTest.cpp

  Log Message:
  -----------
  [pseudo] Key guards by RuleID, add guards to literals (and 0).

After this, NUMERIC_CONSTANT and strings should parse only one way.

There are 8 types of literals, and 24 valid (literal, TokenKind) pairs.
This means adding 8 new named guards (or 24, if we want to assert the token).

It seems fairly clear to me at this point that the guard names are unneccesary
indirection: the guards are in fact coupled to the rule signature.

(Also add the zero guard I forgot in the previous patch.)

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




More information about the All-commits mailing list