aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp
index 4bbc75f..fcac73c 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -283,32 +283,10 @@ LLVMEngine::compileType(CEnv& cenv, const char* name, const AST* expr)
if (i != compiledTypes.end())
return i->second;
- const ATuple* const tup = expr->as_tuple();
- vector<const Type*> ctypes;
- ctypes.push_back(PointerType::get(Type::getInt8Ty(context), NULL)); // RTTI
- for (ATuple::const_iterator i = tup->iter_at(1); i != tup->end(); ++i) {
- const ATuple* tup = (*i)->to_tuple();
- const Type* lt = (tup)
- ? (const Type*)compileType(cenv, tup->fst()->as_symbol()->sym(), *i)
- : llType(*i);
- if (!lt)
- return NULL;
- ctypes.push_back(lt);
- }
-
- Type* structT = StructType::get(context, ctypes, false);
-
- // Tell LLVM opaqueT and structT are the same (for recursive types)
- //PATypeHolder opaqueT = OpaqueType::get(context);
- //((OpaqueType*)opaqueT.get())->refineAbstractTypeTo(structT);
- //structT = cast<StructType>(opaqueT.get()); // updated potentially invalidated structT
-
- Type* ret = PointerType::get(structT, 0);
- module->addTypeName(name, structT);
-
- compiledTypes.insert(make_pair(name, ret));
-
- return ret;
+ const Type* type = llType(expr);
+ module->addTypeName(name, type);
+ compiledTypes.insert(make_pair(name, type));
+ return type;
}
CType