summaryrefslogtreecommitdiff
path: root/Context.hh
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
commitc5e9f890dab0e4595482301d77876793c8bceb8c (patch)
treecb115b6b5b8ffaa5d0de88f9ad5df34016223ec6 /Context.hh
parent3832be8be4b23fb9e93a3f181e4205eadbdbf4de (diff)
finish function node.
Parser.y: rename 'context' to 'ctx' to avoid conflict in new version bison.
Diffstat (limited to 'Context.hh')
-rw-r--r--Context.hh9
1 files changed, 9 insertions, 0 deletions
diff --git a/Context.hh b/Context.hh
index 2bbcaa4..9a30721 100644
--- a/Context.hh
+++ b/Context.hh
@@ -1,21 +1,30 @@
#ifndef PCC_CONTEXT_H
#define PCC_CONTEXT_H
+#include <stack>
+
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
#include "TypeManager.hh"
+#include "VariableList.hh"
namespace pcc {
class Context {
public:
Context(const char* name);
TypeManager* GetTypeManager();
+ VariableList GetGlobals();
llvm::Module* GetModule();
llvm::IRBuilder<>* GetBuilder();
+ VariableList* GetCurrentScope();
+ void PushScope(VariableList* scope);
+ void PopScope();
private:
TypeManager TypeManager_;
+ VariableList globals_;
+ std::stack<VariableList*> scopes_;
llvm::IRBuilder<> builder_;
llvm::Module module_;
};