mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Better compatibility with LLVM < 13 (#319)
* Update wrapper to add type attribute on LLVM < 13
This commit is contained in:
committed by
GitHub
parent
137b474f44
commit
df0b1df1df
@@ -1100,11 +1100,7 @@ void llvm_attribute_add_int(GenContext *context, LLVMValueRef value_to_add_attri
|
||||
|
||||
void llvm_attribute_add_type(GenContext *c, LLVMValueRef value_to_add_attribute_to, unsigned attribute_id, LLVMTypeRef type, int index)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR < 13
|
||||
LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(c->context, attribute_id, 0);
|
||||
#else
|
||||
LLVMAttributeRef llvm_attr = LLVMCreateTypeAttribute(c->context, attribute_id, type);
|
||||
#endif
|
||||
LLVMAddAttributeAtIndex(value_to_add_attribute_to, index, llvm_attr);
|
||||
}
|
||||
|
||||
@@ -1115,11 +1111,7 @@ void llvm_attribute_add(GenContext *context, LLVMValueRef value_to_add_attribute
|
||||
|
||||
void llvm_attribute_add_call_type(GenContext *c, LLVMValueRef call, unsigned attribute_id, int index, LLVMTypeRef type)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR < 13
|
||||
LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(c->context, attribute_id, 0);
|
||||
#else
|
||||
LLVMAttributeRef llvm_attr = LLVMCreateTypeAttribute(c->context, attribute_id, type);
|
||||
#endif
|
||||
LLVMAddCallSiteAttribute(call, index, llvm_attr);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +187,10 @@ void gencontext_end_file_emit(GenContext *c, Context *ast);
|
||||
void gencontext_end_module(GenContext *context);
|
||||
|
||||
LLVMValueRef LLVMConstBswap(LLVMValueRef ConstantVal);
|
||||
#ifndef LLVMCreateTypeAttribute
|
||||
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID,
|
||||
LLVMTypeRef type_ref);
|
||||
#endif
|
||||
|
||||
// BE value
|
||||
void llvm_value_addr(GenContext *c, BEValue *value);
|
||||
|
||||
Reference in New Issue
Block a user