Move TODOs from CARBON_CHECK to SemanticsTODO diagnostics (#2558)

This change is to make it clearer what is a TODO versus unexpected behavior. I'm doing this now because I feel it's been getting a little confusing in code.

So for example if I write the code a return type `-> i32`, I get the diagnostic output plus the dump of the (invalid) IR:

```
/carbon-lang/toolchain/semantics/testdata/function/basic.carbon:37:10: Semantics TODO: HandleReturnType
cross_reference_irs_size: 1
callables: [
]
integer_literals: [
]
strings: [
]
nodes: [
  {kind: CrossReference, arg0: ir0, arg1: block0, type: node0},
  {kind: CrossReference, arg0: ir0, arg1: block1, type: node1},
  {kind: CrossReference, arg0: ir0, arg1: block2, type: node0},
  {kind: CrossReference, arg0: ir0, arg1: block3, type: node0},
]
node_blocks: [
  [
  ],
]
```
This commit is contained in:
Jon Ross-Perkins
2023-01-27 07:47:46 -08:00
committed by GitHub
parent 6feed2ae33
commit 2ffbe72384
5 changed files with 272 additions and 164 deletions
@@ -23,8 +23,6 @@ class SemanticsNodeBlockStack {
llvm::raw_ostream* vlog_stream)
: node_blocks_(&node_blocks), vlog_stream_(vlog_stream) {}
~SemanticsNodeBlockStack() { CARBON_CHECK(stack_.empty()) << stack_.size(); }
// Pushes a new node block. It will be invalid unless PeekForAdd is called in
// order to support lazy allocation.
auto Push() -> void;
@@ -47,6 +45,9 @@ class SemanticsNodeBlockStack {
// Prints the stack for a stack dump.
auto PrintForStackDump(llvm::raw_ostream& output) const -> void;
auto empty() const -> bool { return stack_.empty(); }
auto size() const -> size_t { return stack_.size(); }
private:
// The underlying node block storage on SemanticsIR. Always non-null.
llvm::SmallVector<llvm::SmallVector<SemanticsNodeId>>* const node_blocks_;