-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfuncdecl.cpp
More file actions
36 lines (28 loc) · 760 Bytes
/
funcdecl.cpp
File metadata and controls
36 lines (28 loc) · 760 Bytes
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
#include "funcdecl.hpp"
FuncDecl::FuncDecl(Header *h) : header(h) {};
FuncDecl::~FuncDecl() { delete header; }
void FuncDecl::printAST(std::ostream &out) const {
out << "FuncDecl(";
out << *header;
out << ")";
}
void FuncDecl::sem()
{
/* Notify the header that it should add the function to the symbol table
as a forward declaration */
header->setForward();
/* Perform semantic analysis for forward declaration */
header->sem();
/* The new scope is opened inside header->sem() */
return_stack.pop();
closeScope();
}
llvm::Value* FuncDecl::compile()
{
header->compile();
return nullptr;
}
void FuncDecl::setOuterFunc(std::string outer_func_mangled_name)
{
outerFunc[header->getMangledName()] = outer_func_mangled_name;
}