mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Change "cname" to "extname"
This commit is contained in:
@@ -487,7 +487,7 @@ typedef struct Decl_
|
||||
bool is_substruct : 1;
|
||||
bool has_variable_array : 1;
|
||||
void *backend_ref;
|
||||
const char *cname;
|
||||
const char *extname;
|
||||
AlignSize alignment;
|
||||
const char *section;
|
||||
ArrayIndex offset : 32;
|
||||
|
||||
@@ -594,7 +594,7 @@ typedef enum
|
||||
ATTRIBUTE_OPAQUE,
|
||||
ATTRIBUTE_NORETURN,
|
||||
ATTRIBUTE_SECTION,
|
||||
ATTRIBUTE_CNAME,
|
||||
ATTRIBUTE_EXTNAME,
|
||||
ATTRIBUTE_WEAK,
|
||||
ATTRIBUTE_ALIGN,
|
||||
ATTRIBUTE_PACKED,
|
||||
|
||||
@@ -522,7 +522,7 @@ void llvm_emit_function_decl(GenContext *c, Decl *decl)
|
||||
{
|
||||
assert(decl->decl_kind == DECL_FUNC);
|
||||
// Resolve function backend type for function.
|
||||
LLVMValueRef function = LLVMAddFunction(c->module, decl->cname ?: decl->external_name, llvm_get_type(c, decl->type));
|
||||
LLVMValueRef function = LLVMAddFunction(c->module, decl->extname ?: decl->external_name, llvm_get_type(c, decl->type));
|
||||
decl->backend_ref = function;
|
||||
FunctionSignature *signature = &decl->func_decl.function_signature;
|
||||
FunctionSignature *type_signature = decl->type->func.signature;
|
||||
@@ -628,12 +628,12 @@ void llvm_emit_extern_decl(GenContext *context, Decl *decl)
|
||||
case DECL_POISONED:
|
||||
UNREACHABLE;
|
||||
case DECL_FUNC:
|
||||
decl->backend_ref = LLVMAddFunction(context->module, decl->cname ?: decl->external_name,
|
||||
decl->backend_ref = LLVMAddFunction(context->module, decl->extname ?: decl->external_name,
|
||||
llvm_get_type(context, decl->type));
|
||||
LLVMSetVisibility(decl->backend_ref, LLVMDefaultVisibility);
|
||||
break;
|
||||
case DECL_VAR:
|
||||
decl->backend_ref = LLVMAddGlobal(context->module, llvm_get_type(context, decl->type), decl->cname ?: decl->external_name);
|
||||
decl->backend_ref = LLVMAddGlobal(context->module, llvm_get_type(context, decl->type), decl->extname ?: decl->external_name);
|
||||
LLVMSetVisibility(decl->backend_ref, LLVMDefaultVisibility);
|
||||
break;
|
||||
case DECL_STRUCT:
|
||||
|
||||
@@ -289,9 +289,9 @@ static bool sema_analyse_struct_union(Context *context, Decl *decl)
|
||||
#define SET_ATTR(_X) had = decl->func_decl._X; decl->func_decl._X = true; break
|
||||
switch (attribute)
|
||||
{
|
||||
case ATTRIBUTE_CNAME:
|
||||
had = decl->cname != NULL;
|
||||
decl->cname = attr->expr->const_expr.string.chars;
|
||||
case ATTRIBUTE_EXTNAME:
|
||||
had = decl->extname != NULL;
|
||||
decl->extname = attr->expr->const_expr.string.chars;
|
||||
break;
|
||||
case ATTRIBUTE_SECTION:
|
||||
had = decl->section != NULL;
|
||||
@@ -685,7 +685,7 @@ static AttributeType sema_analyse_attribute(Context *context, Attr *attr, Attrib
|
||||
}
|
||||
static AttributeDomain attribute_domain[NUMBER_OF_ATTRIBUTES] = {
|
||||
[ATTRIBUTE_WEAK] = ATTR_FUNC | ATTR_CONST | ATTR_VAR,
|
||||
[ATTRIBUTE_CNAME] = ~0,
|
||||
[ATTRIBUTE_EXTNAME] = ~0,
|
||||
[ATTRIBUTE_SECTION] = ATTR_FUNC | ATTR_CONST | ATTR_VAR,
|
||||
[ATTRIBUTE_PACKED] = ATTR_STRUCT | ATTR_UNION | ATTR_ERROR,
|
||||
[ATTRIBUTE_NORETURN] = ATTR_FUNC,
|
||||
@@ -741,7 +741,7 @@ static AttributeType sema_analyse_attribute(Context *context, Attr *attr, Attrib
|
||||
}
|
||||
return type;
|
||||
case ATTRIBUTE_SECTION:
|
||||
case ATTRIBUTE_CNAME:
|
||||
case ATTRIBUTE_EXTNAME:
|
||||
if (context->module->is_generic)
|
||||
{
|
||||
SEMA_TOKID_ERROR(attr->name, "'cname' attributes are not allowed in generic modules.");
|
||||
@@ -804,9 +804,9 @@ static inline bool sema_analyse_func(Context *context, Decl *decl)
|
||||
#define SET_ATTR(_X) had = decl->func_decl._X; decl->func_decl._X = true; break
|
||||
switch (attribute)
|
||||
{
|
||||
case ATTRIBUTE_CNAME:
|
||||
had = decl->cname != NULL;
|
||||
decl->cname = attr->expr->const_expr.string.chars;
|
||||
case ATTRIBUTE_EXTNAME:
|
||||
had = decl->extname != NULL;
|
||||
decl->extname = attr->expr->const_expr.string.chars;
|
||||
break;
|
||||
case ATTRIBUTE_SECTION:
|
||||
had = decl->section != NULL;
|
||||
@@ -992,9 +992,9 @@ static inline bool sema_analyse_global(Context *context, Decl *decl)
|
||||
#define SET_ATTR(_X) had = decl->func_decl._X; decl->func_decl._X = true; break
|
||||
switch (attribute)
|
||||
{
|
||||
case ATTRIBUTE_CNAME:
|
||||
had = decl->cname != NULL;
|
||||
decl->cname = attr->expr->const_expr.string.chars;
|
||||
case ATTRIBUTE_EXTNAME:
|
||||
had = decl->extname != NULL;
|
||||
decl->extname = attr->expr->const_expr.string.chars;
|
||||
break;
|
||||
case ATTRIBUTE_SECTION:
|
||||
had = decl->section != NULL;
|
||||
|
||||
@@ -136,7 +136,7 @@ void symtab_init(uint32_t capacity)
|
||||
attribute_list[ATTRIBUTE_ALIGN] = kw_align;
|
||||
attribute_list[ATTRIBUTE_PACKED] = KW_DEF("packed");
|
||||
attribute_list[ATTRIBUTE_SECTION] = KW_DEF("section");
|
||||
attribute_list[ATTRIBUTE_CNAME] = KW_DEF("cname");
|
||||
attribute_list[ATTRIBUTE_EXTNAME] = KW_DEF("extname");
|
||||
attribute_list[ATTRIBUTE_WEAK] = KW_DEF("weak");
|
||||
attribute_list[ATTRIBUTE_OPAQUE] = KW_DEF("opaque");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user