aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm
diff options
context:
space:
mode:
authorTadeo Kondrak <me@tadeo.ca>2021-03-14 22:43:03 -0600
committerTadeo Kondrak <me@tadeo.ca>2021-03-16 17:05:36 -0600
commite8aa6f90d6e8c69f3af32942d0ae2bdf44e34783 (patch)
tree6a052e89591314fa58c1036c9b5d65c01d2b1285 /src/codegen/llvm
parent277b01a089e059d63b6a01de011b666cc0702c38 (diff)
downloadzig-e8aa6f90d6e8c69f3af32942d0ae2bdf44e34783.tar.gz
zig-e8aa6f90d6e8c69f3af32942d0ae2bdf44e34783.zip
stage2 llvm bindings: use correct type for LLVMBool for ABI compat
Diffstat (limited to 'src/codegen/llvm')
-rw-r--r--src/codegen/llvm/bindings.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig
index ff385efd08..7217ca381e 100644
--- a/src/codegen/llvm/bindings.zig
+++ b/src/codegen/llvm/bindings.zig
@@ -1,7 +1,20 @@
//! We do this instead of @cImport because the self-hosted compiler is easier
//! to bootstrap if it does not depend on translate-c.
-const Bool = bool;
+/// Do not compare directly to .True, use toBool() instead.
+pub const Bool = enum(c_int) {
+ False,
+ True,
+ _,
+
+ pub fn fromBool(b: bool) Bool {
+ return @intToEnum(Bool, @boolToInt(b));
+ }
+
+ pub fn toBool(b: Bool) bool {
+ return b != .False;
+ }
+};
pub const AttributeIndex = c_uint;
/// Make sure to use the *InContext functions instead of the global ones.