add alloca as an expression

This commit is contained in:
Folkert 2023-07-29 20:10:52 +02:00
parent 750234f2de
commit cdd2aab217
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
15 changed files with 171 additions and 14 deletions

View file

@ -30,6 +30,7 @@ pub enum UseKind {
ErasedMake(ErasedField),
Erased,
FunctionPointer,
Alloca,
}
pub enum ProblemKind<'a> {
@ -524,6 +525,17 @@ impl<'a, 'r> Ctx<'a, 'r> {
self.check_sym_exists(symbol);
None
}
Expr::Alloca {
initializer,
element_layout,
} => {
if let Some(initializer) = initializer {
self.check_sym_exists(*initializer);
self.check_sym_layout(*initializer, *element_layout, UseKind::Alloca);
}
None
}
Expr::RuntimeErrorFunction(_) => None,
}
}

View file

@ -513,6 +513,7 @@ fn format_use_kind(use_kind: UseKind) -> &'static str {
},
UseKind::Erased => "erasure",
UseKind::FunctionPointer => "function pointer",
UseKind::Alloca => "alloca initializer",
}
}