diff options
author | David Robillard <d@drobilla.net> | 2009-10-15 16:15:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-15 16:15:23 +0000 |
commit | d4b45062903586e86daed7d1f319df6b2133644b (patch) | |
tree | ef4e108822a2b2c22a3bfa7b606bbcb9baa57023 /src | |
parent | d388d0a98042ede74a0240f3eebb9e6b2ef854b1 (diff) | |
download | resp-d4b45062903586e86daed7d1f319df6b2133644b.tar.gz resp-d4b45062903586e86daed7d1f319df6b2133644b.tar.bz2 resp-d4b45062903586e86daed7d1f319df6b2133644b.zip |
Better error reporting for failed function compiles (print uncompilable type).
git-svn-id: http://svn.drobilla.net/resp/tuplr@224 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src')
-rw-r--r-- | src/c.cpp | 10 | ||||
-rw-r--r-- | src/llvm.cpp | 4 |
2 files changed, 9 insertions, 5 deletions
@@ -95,7 +95,8 @@ struct CEngine : public Engine { cprot.push_back(llType(at)); } - THROW_IF(!llType(retT), Cursor(), "return has non-concrete type"); + THROW_IF(!llType(retT), Cursor(), + (format("return has non-concrete type `%1%'") % retT->str()).str()); Function* f = new Function(); f->returnType = *llType(retT); @@ -167,10 +168,11 @@ CEngine::compileLiteral(CEnv& cenv, AST* lit) CFunc CEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT) { - TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(fn); - assert(gt != cenv.tenv.genericTypes.end()); + //TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(fn); + //assert(gt != cenv.tenv.genericTypes.end()); CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine()); - AType* genericType = new AType(*gt->second); + //AType* genericType = new AType(*gt->second); + AType* genericType = cenv.type(fn); AType* thisType = genericType; Subst argsSubst; diff --git a/src/llvm.cpp b/src/llvm.cpp index 1477917..d022413 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -114,7 +114,9 @@ struct LLVMEngine : public Engine { cprot.push_back(llType(at)); } - THROW_IF(!llType(retT), Cursor(), "return has non-concrete type"); + THROW_IF(!llType(retT), Cursor(), + (format("return has non-concrete type `%1%'") % retT->str()).str()); + FunctionType* fT = FunctionType::get(llType(retT), cprot, false); Function* f = Function::Create(fT, linkage, name, module); |