diff options
author | David Robillard <d@drobilla.net> | 2009-01-23 04:24:02 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-01-23 04:24:02 +0000 |
commit | 015eb7a45c1cdd4c762252a78bece2a48947bc89 (patch) | |
tree | 5e7b845399f2945e126f0d0ca9bee3f6dc358485 /ll.cpp | |
parent | 1a9a912aff2708627980f87365d18025a69f44c8 (diff) | |
download | resp-015eb7a45c1cdd4c762252a78bece2a48947bc89.tar.gz resp-015eb7a45c1cdd4c762252a78bece2a48947bc89.tar.bz2 resp-015eb7a45c1cdd4c762252a78bece2a48947bc89.zip |
Remove old error crap.
git-svn-id: http://svn.drobilla.net/resp/llvm-lisp@3 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'll.cpp')
-rw-r--r-- | ll.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
@@ -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<string, Value*> 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; } |