aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-02-25 11:39:46 +0000
committergingerBill <bill@gingerbill.org>2021-02-25 11:39:46 +0000
commit84deee75cc4e7b0d0d37352ce81868564821acfb (patch)
tree731afa32b92939320787ad1956d204d70471d1e5 /src/llvm_backend.cpp
parent82275082ff31fcac6faff60c8095156ddb285aa8 (diff)
Make lb_create_enum_attribute ignore certain attributes (they are not properly supported by the actual LLVM C API)
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index d4b4fd7f2..41a56c312 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -1977,7 +1977,22 @@ lbValue lb_emit_string(lbProcedure *p, lbValue str_elem, lbValue str_len) {
}
LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char const *name, u64 value) {
- unsigned kind = LLVMGetEnumAttributeKindForName(name, gb_strlen(name));
+ String s = make_string_c(name);
+
+ // NOTE(2021-02-25, bill); All this attributes require a type associated with them
+ // and the current LLVM C API does not expose this functionality yet.
+ // It is better to ignore the attributes for the time being
+ if (s == "byval") {
+ return nullptr;
+ } else if (s == "byref") {
+ return nullptr;
+ } else if (s == "preallocated") {
+ return nullptr;
+ } else if (s == "sret") {
+ return nullptr;
+ }
+
+ unsigned kind = LLVMGetEnumAttributeKindForName(name, s.len);
GB_ASSERT_MSG(kind != 0, "unknown attribute: %s", name);
return LLVMCreateEnumAttribute(ctx, kind, value);
}