diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-11-20 00:26:23 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-11-21 00:11:25 +0100 |
commit | 105089e17aa19b326f6d0fd00b00edd9e3ad5564 (patch) | |
tree | 3b72a8c66921f7ee75703e1f7320949f476dcda1 /src/llvm/value.rs | |
parent | 2efe1727344b4fb372df6d6ae3cbe1fa72567542 (diff) | |
download | llvm-kaleidoscope-rs-105089e17aa19b326f6d0fd00b00edd9e3ad5564.tar.gz llvm-kaleidoscope-rs-105089e17aa19b326f6d0fd00b00edd9e3ad5564.zip |
bump to llvm15
Diffstat (limited to 'src/llvm/value.rs')
-rw-r--r-- | src/llvm/value.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/llvm/value.rs b/src/llvm/value.rs index 912c14e..98d2e77 100644 --- a/src/llvm/value.rs +++ b/src/llvm/value.rs @@ -4,13 +4,12 @@ use llvm_sys::{ analysis::{LLVMVerifierFailureAction, LLVMVerifyFunction}, core::{ LLVMAddIncoming, LLVMAppendExistingBasicBlock, LLVMCountBasicBlocks, LLVMCountParams, - LLVMDumpValue, LLVMGetParam, LLVMGetReturnType, LLVMGetValueKind, LLVMGetValueName2, + LLVMDumpValue, LLVMGetParam, LLVMGetValueKind, LLVMGetValueName2, LLVMGlobalGetValueType, LLVMIsAFunction, LLVMIsAPHINode, LLVMSetValueName2, LLVMTypeOf, }, prelude::LLVMValueRef, LLVMTypeKind, LLVMValueKind, }; - use std::ffi::CStr; use std::marker::PhantomData; use std::ops::Deref; @@ -139,13 +138,15 @@ impl<'llvm> FnValue<'llvm> { FnValue(value) } - /// Get a type reference representing the return value of the given function value. + /// Get a type reference representing the function type (return + args) of the given function + /// value. /// /// # Panics /// /// Panics if LLVM API returns a `null` pointer. - pub fn ret_type(&self) -> Type<'llvm> { - let type_ref = unsafe { LLVMGetReturnType(LLVMTypeOf(self.value_ref())) }; + pub fn fn_type(&self) -> Type<'llvm> { + // https://github.com/llvm/llvm-project/issues/72798 + let type_ref = unsafe { LLVMGlobalGetValueType(self.value_ref()) }; Type::new(type_ref) } |