mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 12:50:10 +01:00
- Enhance toolchain/parse/node_kind.def with category x-macros (CARBON_PARSE_NODE_KIND_DECLARATION, CARBON_PARSE_NODE_KIND_EXPRESSION, CARBON_PARSE_NODE_KIND_PATTERN, CARBON_PARSE_NODE_KIND_STATEMENT) that default to CARBON_PARSE_NODE_KIND, keeping node_kind.def as the single source of truth without manual expansion divergence. - Decompose the monolithic toolchain/parse/extract.cpp translation unit into separate compilation units for declarations, expressions, patterns, and statements by expanding respective category x-macros. - Forward-declare Tree and TokenizedBuffer in parse and lex dump headers to reduce header inclusion depth. Assisted-by: Antigravity with Gemini
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
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
|
|
|
|
// This library contains functions to assist dumping objects to stderr during
|
|
// interactive debugging. Functions named `Dump` are intended for direct use by
|
|
// developers, and should use overload resolution to determine which will be
|
|
// invoked. The debugger should do namespace resolution automatically. For
|
|
// example:
|
|
//
|
|
// - lldb: `expr Dump(tree, id)`
|
|
// - gdb: `call Dump(tree, id)`
|
|
//
|
|
// The `DumpNoNewline` functions are helpers that exclude a trailing newline.
|
|
// They're intended to be composed by `Dump` function implementations.
|
|
|
|
#ifndef CARBON_TOOLCHAIN_PARSE_DUMP_H_
|
|
#define CARBON_TOOLCHAIN_PARSE_DUMP_H_
|
|
|
|
#ifndef NDEBUG
|
|
|
|
#include <string>
|
|
|
|
#include "toolchain/lex/token_index.h"
|
|
#include "toolchain/parse/node_ids.h"
|
|
|
|
namespace Carbon::Parse {
|
|
|
|
class Tree;
|
|
|
|
auto Dump(const Tree& tree, Lex::TokenIndex token) -> std::string;
|
|
auto Dump(const Tree& tree, NodeId node_id) -> std::string;
|
|
|
|
} // namespace Carbon::Parse
|
|
|
|
#endif // NDEBUG
|
|
|
|
#endif // CARBON_TOOLCHAIN_PARSE_DUMP_H_
|