diff --git a/src/codegen.cpp b/src/codegen.cpp index c8f8b7f..a488eb6 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -564,13 +564,13 @@ namespace types { fields.push_back(field.second->codegen(builder, structs)); } - auto ty = llvm::StructType::get(*builder.context, fields); + auto ty = llvm::StructType::create(*builder.context, fields); if (this->m_name) ty->setName(*this->m_name); return ty; } else { - auto ty = llvm::StructType::get(*builder.context); + auto ty = llvm::StructType::create(*builder.context); if (this->m_name) ty->setName(*this->m_name); return ty; diff --git a/src/types.cpp b/src/types.cpp index 306b3e2..91e94ff 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -163,7 +163,11 @@ namespace types { std::string StructType::formatted() { std::stringstream out{ "" }; - out << "struct "; + out << "struct"; + if (this->m_is_ref) + out << "(ref)"; + out << " "; + if (this->m_name) { out << *this->m_name << " "; } diff --git a/test.c b/test.c index 77acb4a..8de33a0 100644 --- a/test.c +++ b/test.c @@ -24,5 +24,7 @@ int main() { printf(" first element: %d!", somelist[0]); + struct Otus otus; + return 0; } \ No newline at end of file