tipc
A TIP to LLVM compiler
ASTVariableExpr.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ASTExpr.h"
4 
7 class ASTVariableExpr : public ASTExpr {
8  std::string NAME;
9 
10 public:
11  ASTVariableExpr(std::string NAME) : NAME(NAME) {}
12  std::string getName() const { return NAME; }
13  void accept(ASTVisitor *visitor) override;
14  llvm::Value *codegen() override;
15 
16 protected:
17  std::ostream &print(std::ostream &out) const override;
18 };
Abstract class for all expression subtypes.
Definition: ASTExpr.h:7
Class for referencing a variable.
Definition: ASTVariableExpr.h:7
std::string getName() const
Definition: ASTVariableExpr.h:12
void accept(ASTVisitor *visitor) override
Visit the children of this node and apply the visitor.
Definition: ASTVariableExpr.cpp:4
ASTVariableExpr(std::string NAME)
Definition: ASTVariableExpr.h:11
llvm::Value * codegen() override
Perform code generation and return an LLVM value the code.
Definition: CodeGenFunctions.cpp:467
std::ostream & print(std::ostream &out) const override
Definition: ASTVariableExpr.cpp:9
Base class for AST visitors.
Definition: ASTVisitor.h:23