mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 22:06:38 +00:00

- 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
31 lines
983 B
C++
31 lines
983 B
C++
//===--- CXXTest.cpp ------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "clang-pseudo/cxx/CXX.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace clang {
|
|
namespace pseudo {
|
|
namespace cxx {
|
|
namespace {
|
|
|
|
TEST(CXX, GeneratedEnums) {
|
|
const auto &Lang = clang::pseudo::cxx::getLanguage();
|
|
EXPECT_EQ("iteration-statement",
|
|
Lang.G.symbolName(Symbol::iteration_statement));
|
|
EXPECT_EQ("iteration-statement := DO statement WHILE ( expression ) ;",
|
|
Lang.G.dumpRule(
|
|
rule::iteration_statement::
|
|
DO__statement__WHILE__L_PAREN__expression__R_PAREN__SEMI));
|
|
}
|
|
|
|
} // namespace
|
|
} // namespace cxx
|
|
} // namespace pseudo
|
|
} // namespace clang
|