forked from carbon-language/carbon-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semantics_ir.h
44 lines (32 loc) · 1.18 KB
/
semantics_ir.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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 CARBON_TOOLCHAIN_SEMANTICS_SEMANTICS_IR_H_
#define CARBON_TOOLCHAIN_SEMANTICS_SEMANTICS_IR_H_
#include "llvm/ADT/SmallVector.h"
#include "toolchain/parser/parse_tree.h"
#include "toolchain/semantics/node_store.h"
namespace Carbon::Testing {
class SemanticsIRForTest;
} // namespace Carbon::Testing
namespace Carbon {
// Provides semantic analysis on a ParseTree.
class SemanticsIR {
public:
// File-level declarations.
auto root_block() const -> llvm::ArrayRef<Semantics::NodeRef> {
return root_block_;
}
// Prints the node information.
void Print(llvm::raw_ostream& out, Semantics::NodeRef node_ref) const;
private:
friend class SemanticsIRFactory;
friend class Testing::SemanticsIRForTest;
explicit SemanticsIR(const ParseTree& parse_tree)
: parse_tree_(&parse_tree) {}
Semantics::NodeStore nodes_;
llvm::SmallVector<Semantics::NodeRef, 0> root_block_;
const ParseTree* parse_tree_;
};
} // namespace Carbon
#endif // CARBON_TOOLCHAIN_SEMANTICS_SEMANTICS_IR_H_