Implement calls in the toolchain. (#2582)

This adds tracking of call information plus basic type checking. It adds a builtin for the empty tuple, mainly so that I have the basis for a default function return type.

As an aside, it also unifies printing within SemanticsIR, fixing a missing comma after callables.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2023-02-13 16:15:04 -08:00
committed by GitHub
co-authored by Richard Smith
parent 22d7cd19ed
commit f7924aa93f
48 changed files with 1578 additions and 398 deletions
@@ -19,9 +19,10 @@ namespace Carbon {
class SemanticsNodeBlockStack {
public:
explicit SemanticsNodeBlockStack(
llvm::StringLiteral name,
llvm::SmallVector<llvm::SmallVector<SemanticsNodeId>>& node_blocks,
llvm::raw_ostream* vlog_stream)
: node_blocks_(&node_blocks), vlog_stream_(vlog_stream) {}
: name_(name), node_blocks_(&node_blocks), vlog_stream_(vlog_stream) {}
// Pushes a new node block. It will be invalid unless PeekForAdd is called in
// order to support lazy allocation.
@@ -45,6 +46,9 @@ class SemanticsNodeBlockStack {
auto size() const -> size_t { return stack_.size(); }
private:
// A name for debugging.
llvm::StringLiteral name_;
// The underlying node block storage on SemanticsIR. Always non-null.
llvm::SmallVector<llvm::SmallVector<SemanticsNodeId>>* const node_blocks_;