dump.h 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. // This library contains functions to assist dumping objects to stderr during
  5. // interactive debugging. Functions named `Dump` are intended for direct use by
  6. // developers, and should use overload resolution to determine which will be
  7. // invoked. The debugger should do namespace resolution automatically. For
  8. // example:
  9. //
  10. // - lldb: `expr Dump(tokens, id)`
  11. // - gdb: `call Dump(tokens, id)`
  12. //
  13. // The `DumpNoNewline` functions are helpers that exclude a trailing newline.
  14. // They're intended to be composed by `Dump` function implementations.
  15. #ifndef CARBON_TOOLCHAIN_LEX_DUMP_H_
  16. #define CARBON_TOOLCHAIN_LEX_DUMP_H_
  17. #ifndef NDEBUG
  18. #include "toolchain/lex/tokenized_buffer.h"
  19. namespace Carbon::Lex {
  20. auto Dump(const TokenizedBuffer& tokens, TokenIndex token) -> std::string;
  21. } // namespace Carbon::Lex
  22. #endif // NDEBUG
  23. #endif // CARBON_TOOLCHAIN_LEX_DUMP_H_