mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 11:25:49 +01:00
This is a followup from #4834, I searched for "invalid" uses in our codebase. This is mostly changing comments, and a couple debug functions, but shouldn't affect testable behavior. Note a couple things I'll highlight as not changing (but could) are: - `ReturnTypeInfo::is_valid` - `"invalid"` uses in the formatter - `AddInvalid` for `!has_value` in `inst_fingerprinter` (because the cases it's called sound invalid-ish)
37 lines
955 B
C++
37 lines
955 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
|
|
|
|
#ifndef NDEBUG
|
|
|
|
#include "toolchain/lex/dump.h"
|
|
|
|
#include "common/ostream.h"
|
|
|
|
namespace Carbon::Lex {
|
|
|
|
auto DumpNoNewline(const TokenizedBuffer& tokens, TokenIndex token) -> void {
|
|
if (!token.has_value()) {
|
|
llvm::errs() << "TokenIndex(<none>)";
|
|
return;
|
|
}
|
|
|
|
auto kind = tokens.GetKind(token);
|
|
auto line = tokens.GetLineNumber(token);
|
|
auto col = tokens.GetColumnNumber(token);
|
|
|
|
llvm::errs() << "TokenIndex(kind: " << kind << ", loc: ";
|
|
llvm::errs().write_escaped(tokens.source().filename());
|
|
llvm::errs() << ":" << line << ":" << col << ")";
|
|
}
|
|
|
|
LLVM_DUMP_METHOD auto Dump(const TokenizedBuffer& tokens, TokenIndex token)
|
|
-> void {
|
|
DumpNoNewline(tokens, token);
|
|
llvm::errs() << '\n';
|
|
}
|
|
|
|
} // namespace Carbon::Lex
|
|
|
|
#endif // NDEBUG
|