mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 20:40:10 +01:00
This keeps all of our C++ code written in C++ source files, and avoids the increasing size of the RTTI generation script we'd started to see in #2699. Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
21 lines
781 B
C++
21 lines
781 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "explorer/ast/ast_rtti.h"
|
|
|
|
namespace Carbon {
|
|
|
|
// Define kind names for the base enumeration type.
|
|
CARBON_DEFINE_ENUM_CLASS_NAMES(AstRttiNodeKind) = {
|
|
CARBON_AST_FOR_EACH_FINAL_CLASS(CARBON_ENUM_CLASS_NAME_STRING)};
|
|
|
|
// For other kind enumerations, reuse the same table.
|
|
#define DEFINE_NAME_FUNCTION(C) \
|
|
CARBON_ENUM_NAME_FUNCTION(C##Kind) { \
|
|
return AstRttiNodeKind(static_cast<const C##Kind&>(*this)).name(); \
|
|
}
|
|
CARBON_AST_FOR_EACH_ABSTRACT_CLASS(DEFINE_NAME_FUNCTION)
|
|
|
|
} // namespace Carbon
|