From 015eb7a45c1cdd4c762252a78bece2a48947bc89 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Jan 2009 04:24:02 +0000 Subject: Remove old error crap. git-svn-id: http://svn.drobilla.net/resp/llvm-lisp@3 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- ll.cpp | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'll.cpp') diff --git a/ll.cpp b/ll.cpp index bf2b48a..41106a8 100644 --- a/ll.cpp +++ b/ll.cpp @@ -194,23 +194,6 @@ private: * Parser - Transform S-Expressions into AST nodes * ***************************************************************************/ -/// Error* - These are little helper functions for error handling. -AST* Error(const char *msg) -{ - std::cerr << "Error: " << msg << endl; - return 0; -} - -ASTPrototype* ErrorP(const char *Str) -{ - return (ASTPrototype*)Error(Str); -} - -ASTFunction* ErrorF(const char *Str) -{ - return (ASTFunction*)Error(Str); -} - static const std::string& head(const SExp& exp) { static const std::string empty = ""; @@ -278,7 +261,7 @@ static ASTPrototype* ParsePrototype(bool foreign, const SExp& exp) if (i->type == SExp::ATOM) args.push_back(i->atom); else - return ErrorP("Expected parameter name, found list"); + throw SyntaxError("Expected parameter name, found list"); return new ASTPrototype(foreign, name, args); } @@ -357,12 +340,6 @@ struct CEnv { map env; }; -Value* ErrorV(const char *Str) -{ - Error(Str); - return 0; -} - Value* ASTNumber::Codegen(CEnv& cenv) { return ConstantFP::get(APFloat(_val)); @@ -409,7 +386,6 @@ Value* ASTIf::Codegen(CEnv& cenv) // Emit then value. cenv.builder.SetInsertPoint(thenBB); - Value* thenV = _then->Codegen(cenv); cenv.builder.CreateBr(mergeBB); @@ -419,7 +395,6 @@ Value* ASTIf::Codegen(CEnv& cenv) // Emit else block. parent->getBasicBlockList().push_back(elseBB); cenv.builder.SetInsertPoint(elseBB); - Value* elseV = _else->Codegen(cenv); cenv.builder.CreateBr(mergeBB); @@ -489,7 +464,7 @@ Function* ASTFunction::Funcgen(CEnv& cenv) verifyFunction(*f); // Validate generated code cenv.fpm.run(*f); // Optimize function return f; - } catch (std::exception e) { + } catch (SyntaxError e) { f->eraseFromParent(); // Error reading body, remove function throw e; } -- cgit v1.2.1