aboutsummaryrefslogtreecommitdiff
path: root/include/cps/CodeGen.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cps/CodeGen.h')
-rw-r--r--include/cps/CodeGen.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h
index 07ff3e8..268ba7e 100644
--- a/include/cps/CodeGen.h
+++ b/include/cps/CodeGen.h
@@ -59,6 +59,8 @@ class CodeGen {
llvm::Value *FalseStr; // "FALSE"
llvm::Value *EmptyStringStr; // ""
+ bool HadError = false;
+
void SetupExternalFunctions();
llvm::AllocaInst *CreateEntryBlockAlloca(llvm::Function *TheFunction, const std::string &VarName);
llvm::AllocaInst *CreateEntryBlockAlloca(llvm::Function *TheFunction, llvm::Type *AllocType, const std::string &VarName);
@@ -80,6 +82,8 @@ public:
~CodeGen();
void compile(const std::vector<std::unique_ptr<StmtAST>> &Statements);
void print();
+ bool hadError() const { return HadError; }
+ void reportError(const char *Fmt, ...);
llvm::Value *emitExpr(ExprAST *Expr);
void emitStmt(StmtAST *Stmt);