Fix warnings, cleanup
This commit is contained in:
parent
61d3ea61ee
commit
726251e39c
@ -569,42 +569,6 @@ impl TypeHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FunctionHolder {
|
impl FunctionHolder {
|
||||||
unsafe fn compile_debug_info(
|
|
||||||
&self,
|
|
||||||
di_builder: LLVMDIBuilderRef,
|
|
||||||
parent: LLVMMetadataRef,
|
|
||||||
file: LLVMMetadataRef,
|
|
||||||
types: &mut HashMap<DebugTypeValue, LLVMMetadataRef>,
|
|
||||||
func: LLVMFunction,
|
|
||||||
scope: DebugScopeHolder,
|
|
||||||
) -> LLVMMetadataRef {
|
|
||||||
unsafe {
|
|
||||||
let DebugScopeKind::Subprogram(subprogram) = scope.data.kind else {
|
|
||||||
panic!();
|
|
||||||
};
|
|
||||||
|
|
||||||
let mangled_length_ptr = &mut 0;
|
|
||||||
let mangled_name = LLVMGetValueName2(func.value_ref, mangled_length_ptr);
|
|
||||||
let mangled_length = *mangled_length_ptr;
|
|
||||||
LLVMDIBuilderCreateFunction(
|
|
||||||
di_builder,
|
|
||||||
parent,
|
|
||||||
into_cstring(subprogram.name.clone()).as_ptr(),
|
|
||||||
subprogram.name.clone().len(),
|
|
||||||
mangled_name,
|
|
||||||
mangled_length,
|
|
||||||
file,
|
|
||||||
subprogram.location.pos.line,
|
|
||||||
*types.get(&subprogram.ty).unwrap(),
|
|
||||||
subprogram.opts.is_local as i32,
|
|
||||||
subprogram.opts.is_definition as i32,
|
|
||||||
subprogram.opts.scope_line,
|
|
||||||
subprogram.opts.flags.as_llvm(),
|
|
||||||
subprogram.opts.is_optimized as i32,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn compile_signature(
|
unsafe fn compile_signature(
|
||||||
&self,
|
&self,
|
||||||
context: &LLVMContext,
|
context: &LLVMContext,
|
||||||
|
@ -208,11 +208,7 @@ impl DebugInformation {
|
|||||||
self.metadata.clone()
|
self.metadata.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn get_scopes(&self) -> Rc<RefCell<DebugScopeHolder>> {
|
pub(crate) fn get_scope(&self) -> Rc<RefCell<DebugScopeHolder>> {
|
||||||
// self.scope.clone()
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn get_scope(&self) -> Rc<RefCell<DebugScopeHolder>> {
|
|
||||||
self.scope.clone()
|
self.scope.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ impl ConstValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||||
enum TypeCategory {
|
pub enum TypeCategory {
|
||||||
SignedInteger,
|
SignedInteger,
|
||||||
UnsignedInteger,
|
UnsignedInteger,
|
||||||
Void,
|
Void,
|
||||||
|
@ -122,8 +122,8 @@ pub enum BinaryOperator {
|
|||||||
And,
|
And,
|
||||||
Or,
|
Or,
|
||||||
Xor,
|
Xor,
|
||||||
BWAnd,
|
BitAnd,
|
||||||
BWOr,
|
BitOr,
|
||||||
LT,
|
LT,
|
||||||
LE,
|
LE,
|
||||||
GT,
|
GT,
|
||||||
@ -141,9 +141,8 @@ impl BinaryOperator {
|
|||||||
Mult => 15,
|
Mult => 15,
|
||||||
Div => 20,
|
Div => 20,
|
||||||
Mod => 20,
|
Mod => 20,
|
||||||
BWAnd => 90,
|
BitAnd => 90,
|
||||||
BWOr => 90,
|
BitOr => 90,
|
||||||
BWXor => 90,
|
|
||||||
BitshiftLeft => 100,
|
BitshiftLeft => 100,
|
||||||
BitshiftRight => 100,
|
BitshiftRight => 100,
|
||||||
And => 150,
|
And => 150,
|
||||||
|
@ -518,8 +518,8 @@ impl Parse for BinaryOperator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(Some(Token::Hat), _) => BinaryOperator::Xor,
|
(Some(Token::Hat), _) => BinaryOperator::Xor,
|
||||||
(Some(Token::Et), _) => BinaryOperator::BWAnd,
|
(Some(Token::Et), _) => BinaryOperator::BitAnd,
|
||||||
(Some(Token::Pipe), _) => BinaryOperator::BWOr,
|
(Some(Token::Pipe), _) => BinaryOperator::BitOr,
|
||||||
|
|
||||||
(Some(Token::LessThan), _) => BinaryOperator::LT,
|
(Some(Token::LessThan), _) => BinaryOperator::LT,
|
||||||
(Some(Token::GreaterThan), _) => BinaryOperator::GT,
|
(Some(Token::GreaterThan), _) => BinaryOperator::GT,
|
||||||
|
@ -459,8 +459,8 @@ impl ast::BinaryOperator {
|
|||||||
ast::BinaryOperator::BitshiftRight => mir::BinaryOperator::BitshiftRight,
|
ast::BinaryOperator::BitshiftRight => mir::BinaryOperator::BitshiftRight,
|
||||||
ast::BinaryOperator::BitshiftLeft => mir::BinaryOperator::BitshiftLeft,
|
ast::BinaryOperator::BitshiftLeft => mir::BinaryOperator::BitshiftLeft,
|
||||||
ast::BinaryOperator::Xor => mir::BinaryOperator::Xor,
|
ast::BinaryOperator::Xor => mir::BinaryOperator::Xor,
|
||||||
ast::BinaryOperator::BWAnd => mir::BinaryOperator::BitAnd,
|
ast::BinaryOperator::BitAnd => mir::BinaryOperator::BitAnd,
|
||||||
ast::BinaryOperator::BWOr => mir::BinaryOperator::BitOr,
|
ast::BinaryOperator::BitOr => mir::BinaryOperator::BitOr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use std::ops::BitAnd;
|
|
||||||
|
|
||||||
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr, Type};
|
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr, Type};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! This module contains code relevant to doing a type checking pass on the MIR.
|
//! This module contains code relevant to doing a type checking pass on the MIR.
|
||||||
//! During typechecking relevant types are also coerced if possible.
|
//! During typechecking relevant types are also coerced if possible.
|
||||||
use std::{collections::HashSet, convert::Infallible, hint, iter};
|
use std::{collections::HashSet, convert::Infallible, iter};
|
||||||
|
|
||||||
use crate::{mir::*, util::try_all};
|
use crate::{mir::*, util::try_all};
|
||||||
use VagueType as Vague;
|
use VagueType as Vague;
|
||||||
@ -750,9 +750,7 @@ impl Expression {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(iter::repeat(TypeKind::Vague(Vague::Unknown)));
|
.chain(iter::repeat(TypeKind::Vague(Vague::Unknown)));
|
||||||
|
|
||||||
for (i, (param, true_param_t)) in
|
for (param, true_param_t) in function_call.parameters.iter_mut().zip(true_params_iter) {
|
||||||
function_call.parameters.iter_mut().zip(true_params_iter).enumerate()
|
|
||||||
{
|
|
||||||
// Typecheck every param separately
|
// Typecheck every param separately
|
||||||
let param_res = param.typecheck(state, &typerefs, HintKind::Coerce(true_param_t.clone()));
|
let param_res = param.typecheck(state, &typerefs, HintKind::Coerce(true_param_t.clone()));
|
||||||
let param_t = state.or_else(param_res, TypeKind::Vague(Vague::Unknown), param.1);
|
let param_t = state.or_else(param_res, TypeKind::Vague(Vague::Unknown), param.1);
|
||||||
|
@ -285,7 +285,7 @@ impl Block {
|
|||||||
let rhs_ref = state.ok(rhs_infer, rhs.1);
|
let rhs_ref = state.ok(rhs_infer, rhs.1);
|
||||||
|
|
||||||
// Try to narrow the lhs with rhs
|
// Try to narrow the lhs with rhs
|
||||||
if let (Some(mut lhs_ref), Some(mut rhs_ref)) = (lhs_ref, rhs_ref) {
|
if let (Some(lhs_ref), Some(mut rhs_ref)) = (lhs_ref, rhs_ref) {
|
||||||
rhs_ref.narrow(&lhs_ref);
|
rhs_ref.narrow(&lhs_ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user