fixed: check errors
This commit is contained in:
parent
501fa5abbb
commit
09ac2251dc
|
@ -35,7 +35,7 @@ const char* get_absolute_link_path(const TargetConfig* config, const char* link_
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLinkConfig* lld_create_link_config(const Target* target, const TargetConfig* target_config, const Module* module) {
|
TargetLinkConfig* lld_create_link_config(__attribute__((unused)) const Target* target, const TargetConfig* target_config, const Module* module) {
|
||||||
DEBUG("generating link configuration");
|
DEBUG("generating link configuration");
|
||||||
|
|
||||||
TargetLinkConfig* config = mem_alloc(MemoryNamespaceLld, sizeof(TargetLinkConfig));
|
TargetLinkConfig* config = mem_alloc(MemoryNamespaceLld, sizeof(TargetLinkConfig));
|
||||||
|
@ -133,9 +133,6 @@ BackendError lld_link_target(TargetLinkConfig* config) {
|
||||||
print_message(Info, "%s", arguments);
|
print_message(Info, "%s", arguments);
|
||||||
g_free(arguments);
|
g_free(arguments);
|
||||||
|
|
||||||
const char* message = NULL;
|
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
INFO("done linking target...");
|
INFO("done linking target...");
|
||||||
|
|
||||||
g_array_free(argv, TRUE);
|
g_array_free(argv, TRUE);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <codegen/backend.h>
|
#include <codegen/backend.h>
|
||||||
#include <llvm/backend.h>
|
#include <llvm/backend.h>
|
||||||
|
|
||||||
TargetLinkConfig* lld_create_link_config(const Target * target, const TargetConfig* target_config, const Module* module);
|
TargetLinkConfig* lld_create_link_config(__attribute__((unused)) const Target * target, const TargetConfig* target_config, const Module* module);
|
||||||
|
|
||||||
BackendError lld_link_target(TargetLinkConfig* config);
|
BackendError lld_link_target(TargetLinkConfig* config);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ BackendError impl_bitwise_operation(LLVMBackendCompileUnit *unit,
|
||||||
LLVMValueRef llvm_rhs = NULL;
|
LLVMValueRef llvm_rhs = NULL;
|
||||||
LLVMValueRef llvm_lhs = NULL;
|
LLVMValueRef llvm_lhs = NULL;
|
||||||
|
|
||||||
if (operation->impl.arithmetic == BitwiseNot) {
|
if (operation->impl.bitwise == BitwiseNot) {
|
||||||
// single operand
|
// single operand
|
||||||
rhs = g_array_index(operation->operands, Expression*, 0);
|
rhs = g_array_index(operation->operands, Expression*, 0);
|
||||||
impl_expr(unit, scope, builder, rhs, FALSE, &llvm_rhs);
|
impl_expr(unit, scope, builder, rhs, FALSE, &llvm_rhs);
|
||||||
|
@ -56,6 +56,7 @@ BackendError impl_bitwise_operation(LLVMBackendCompileUnit *unit,
|
||||||
* @param integral
|
* @param integral
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[maybe_unused]]
|
||||||
static LLVMValueRef convert_integral_to_boolean(
|
static LLVMValueRef convert_integral_to_boolean(
|
||||||
LLVMBuilderRef builder, LLVMValueRef integral) {
|
LLVMBuilderRef builder, LLVMValueRef integral) {
|
||||||
// type of input
|
// type of input
|
||||||
|
@ -390,7 +391,6 @@ BackendError impl_address_of(LLVMBackendCompileUnit *unit, LLVMLocalScope *scope
|
||||||
LLVMBuilderRef builder, AddressOf* addressOf,
|
LLVMBuilderRef builder, AddressOf* addressOf,
|
||||||
LLVMValueRef *llvm_result) {
|
LLVMValueRef *llvm_result) {
|
||||||
|
|
||||||
LLVMValueRef llvm_variable = NULL;
|
|
||||||
BackendError err = impl_expr(unit, scope, builder, addressOf->variable, FALSE, llvm_result);
|
BackendError err = impl_expr(unit, scope, builder, addressOf->variable, FALSE, llvm_result);
|
||||||
|
|
||||||
if (err.kind != Success) {
|
if (err.kind != Success) {
|
||||||
|
@ -434,7 +434,7 @@ BackendError impl_expr(LLVMBackendCompileUnit *unit, LLVMLocalScope *scope,
|
||||||
|
|
||||||
switch (expr->kind) {
|
switch (expr->kind) {
|
||||||
case ExpressionKindConstant:
|
case ExpressionKindConstant:
|
||||||
err = get_const_type_value(unit, builder, scope->func_scope->global_scope,
|
err = get_const_type_value(unit, scope->func_scope->global_scope,
|
||||||
&expr->impl.constant, llvm_result);
|
&expr->impl.constant, llvm_result);
|
||||||
break;
|
break;
|
||||||
case ExpressionKindTransmute:
|
case ExpressionKindTransmute:
|
||||||
|
|
|
@ -50,7 +50,7 @@ LLVMValueRef get_variable(const LLVMLocalScope* scope, const char* name) {
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, name);
|
LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, (char*) name);
|
||||||
return global_var;
|
return global_var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ LLVMBool is_parameter(const LLVMLocalScope* scope, const char* name) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, name);
|
LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, (char*) name);
|
||||||
return global_var != NULL;
|
return global_var != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ BackendError impl_func_type(LLVMBackendCompileUnit* unit,
|
||||||
|
|
||||||
*llvm_fun = LLVMAddFunction(unit->module, func->name, llvm_fun_type);
|
*llvm_fun = LLVMAddFunction(unit->module, func->name, llvm_fun_type);
|
||||||
|
|
||||||
g_hash_table_insert(scope->functions, func->name, llvm_fun_type);
|
g_hash_table_insert(scope->functions, (char*) func->name, llvm_fun_type);
|
||||||
|
|
||||||
g_array_free(llvm_params, FALSE);
|
g_array_free(llvm_params, FALSE);
|
||||||
|
|
||||||
|
@ -217,12 +217,10 @@ BackendError impl_function_types(LLVMBackendCompileUnit* unit,
|
||||||
gpointer val = NULL;
|
gpointer val = NULL;
|
||||||
|
|
||||||
BackendError err = SUCCESS;
|
BackendError err = SUCCESS;
|
||||||
size_t function_count = 0;
|
|
||||||
while (g_hash_table_iter_next(&iterator, &key, &val) != FALSE) {
|
while (g_hash_table_iter_next(&iterator, &key, &val) != FALSE) {
|
||||||
Function* func = (Function*) val;
|
Function* func = (Function*) val;
|
||||||
LLVMValueRef llvm_func;
|
LLVMValueRef llvm_func;
|
||||||
err = impl_func_type(unit, scope, func, &llvm_func);
|
err = impl_func_type(unit, scope, func, &llvm_func);
|
||||||
function_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -40,7 +40,7 @@ static BackendError get_const_composite_value(CompositeType composite,
|
||||||
llvm_value);
|
llvm_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
BackendError impl_reference_const(LLVMBackendCompileUnit* unit, LLVMBuilderRef builder, TypeValue* value, LLVMValueRef* llvm_value) {
|
BackendError impl_reference_const(LLVMBackendCompileUnit* unit, TypeValue* value, LLVMValueRef* llvm_value) {
|
||||||
BackendError err = SUCCESS;
|
BackendError err = SUCCESS;
|
||||||
if (value->type->kind == TypeKindReference && compareTypes(value->type, (Type*) &StringLiteralType)) {
|
if (value->type->kind == TypeKindReference && compareTypes(value->type, (Type*) &StringLiteralType)) {
|
||||||
// is string literal
|
// is string literal
|
||||||
|
@ -63,7 +63,6 @@ BackendError impl_reference_const(LLVMBackendCompileUnit* unit, LLVMBuilderRef b
|
||||||
}
|
}
|
||||||
|
|
||||||
BackendError get_const_type_value(LLVMBackendCompileUnit* unit,
|
BackendError get_const_type_value(LLVMBackendCompileUnit* unit,
|
||||||
LLVMBuilderRef builder,
|
|
||||||
LLVMGlobalScope* scope,
|
LLVMGlobalScope* scope,
|
||||||
TypeValue* gemstone_value,
|
TypeValue* gemstone_value,
|
||||||
LLVMValueRef* llvm_value) {
|
LLVMValueRef* llvm_value) {
|
||||||
|
@ -87,7 +86,7 @@ BackendError get_const_type_value(LLVMBackendCompileUnit* unit,
|
||||||
llvm_value);
|
llvm_value);
|
||||||
break;
|
break;
|
||||||
case TypeKindReference:
|
case TypeKindReference:
|
||||||
err = impl_reference_const(unit, builder, gemstone_value, llvm_value);
|
err = impl_reference_const(unit, gemstone_value, llvm_value);
|
||||||
break;
|
break;
|
||||||
case TypeKindBox:
|
case TypeKindBox:
|
||||||
err =
|
err =
|
||||||
|
@ -251,8 +250,8 @@ BackendError impl_box_type(LLVMBackendCompileUnit* unit, LLVMGlobalScope* scope,
|
||||||
|
|
||||||
DEBUG("implementing member: %s ", ((BoxMember*)val)->name);
|
DEBUG("implementing member: %s ", ((BoxMember*)val)->name);
|
||||||
|
|
||||||
LLVMTypeRef llvm_type = NULL;
|
LLVMTypeRef llvm_local_type = NULL;
|
||||||
err = get_type_impl(unit, scope, member_type, &llvm_type);
|
err = get_type_impl(unit, scope, member_type, &llvm_local_type);
|
||||||
|
|
||||||
if (err.kind != Success) {
|
if (err.kind != Success) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,7 +19,6 @@ BackendError get_type_default_value(LLVMBackendCompileUnit* unit,
|
||||||
LLVMValueRef* llvm_value);
|
LLVMValueRef* llvm_value);
|
||||||
|
|
||||||
BackendError get_const_type_value(LLVMBackendCompileUnit* unit,
|
BackendError get_const_type_value(LLVMBackendCompileUnit* unit,
|
||||||
LLVMBuilderRef builder,
|
|
||||||
LLVMGlobalScope* scope,
|
LLVMGlobalScope* scope,
|
||||||
TypeValue* gemstone_value,
|
TypeValue* gemstone_value,
|
||||||
LLVMValueRef* llvm_value);
|
LLVMValueRef* llvm_value);
|
||||||
|
|
|
@ -1664,14 +1664,15 @@ int createAssign(Statement *ParentStatement, AST_NODE_PTR currentNode) {
|
||||||
assign.destination = mem_alloc(MemoryNamespaceSet, sizeof(StorageExpr));
|
assign.destination = mem_alloc(MemoryNamespaceSet, sizeof(StorageExpr));
|
||||||
|
|
||||||
int status = createStorageExpr(assign.destination, AST_get_node(currentNode, 0));
|
int status = createStorageExpr(assign.destination, AST_get_node(currentNode, 0));
|
||||||
|
if (status == SEMANTIC_ERROR) {
|
||||||
|
return SEMANTIC_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
assign.value = createExpression(AST_get_node(currentNode, 1));
|
assign.value = createExpression(AST_get_node(currentNode, 1));
|
||||||
if (assign.value == NULL) {
|
if (assign.value == NULL) {
|
||||||
return SEMANTIC_ERROR;
|
return SEMANTIC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type *varType = NULL;
|
|
||||||
|
|
||||||
// TODO: check assignment type compatability
|
// TODO: check assignment type compatability
|
||||||
|
|
||||||
ParentStatement->impl.assignment = assign;
|
ParentStatement->impl.assignment = assign;
|
||||||
|
|
Loading…
Reference in New Issue