-
Notifications
You must be signed in to change notification settings - Fork 0
/
SymbolType.h
34 lines (27 loc) · 857 Bytes
/
SymbolType.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
#pragma once
#include <initializer_list>
#include <string>
#include <llvm/IR/DerivedTypes.h>
#include <llvm/IR/Type.h>
#include <llvm/IR/Value.h>
enum SymbolSuperType {
TY_INVALID,
TY_INT,
TY_DOUBLE,
};
class SymbolType {
public:
// Constructor
explicit SymbolType(SymbolSuperType superType) : superType(superType) {}
// Public methods
[[nodiscard]] bool is(SymbolSuperType superType) const;
[[nodiscard]] bool isOneOf(const std::initializer_list<SymbolSuperType> &superTypes) const;
[[nodiscard]] std::string getName() const;
[[nodiscard]] llvm::Type *toLLVMType(llvm::LLVMContext &context) const;
// Overloaded operators
friend bool operator==(const SymbolType &lhs, const SymbolType &rhs);
friend bool operator!=(const SymbolType &lhs, const SymbolType &rhs);
private:
// Private members
SymbolSuperType superType;
};