tipc
A TIP to LLVM compiler
ASTDeclNode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ASTNode.h"
4 
7 class ASTDeclNode : public ASTNode {
8  std::string NAME;
9 
10 public:
11  ASTDeclNode(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 };
Class for declaring a name, e.g., function, parameter, variable.
Definition: ASTDeclNode.h:7
void accept(ASTVisitor *visitor) override
Visit the children of this node and apply the visitor.
Definition: ASTDeclNode.cpp:4
std::string getName() const
Definition: ASTDeclNode.h:12
ASTDeclNode(std::string NAME)
Definition: ASTDeclNode.h:11
llvm::Value * codegen() override
Perform code generation and return an LLVM value the code.
Definition: CodeGenFunctions.cpp:775
std::ostream & print(std::ostream &out) const override
Definition: ASTDeclNode.cpp:9
Abstract base class for all AST nodes.
Definition: ASTNode.h:34
Base class for AST visitors.
Definition: ASTVisitor.h:23