feat(gs/achilles): Codegen string literals
Codegen string literals to LLVM as (for now) global C string pointers Change-Id: I6dcd7fa25a7806a2f708a8e9275c9a01174fd0cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/2613 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
b1c4b84dba
commit
fec6595d21
1 changed files with 5 additions and 1 deletions
|
@ -92,7 +92,11 @@ impl<'ctx, 'ast> Codegen<'ctx, 'ast> {
|
|||
Literal::Bool(b) => Ok(AnyValueEnum::IntValue(
|
||||
ty.const_int(if *b { 1 } else { 0 }, false),
|
||||
)),
|
||||
Literal::String(_) => todo!(),
|
||||
Literal::String(s) => Ok(self
|
||||
.builder
|
||||
.build_global_string_ptr(s, "s")
|
||||
.as_pointer_value()
|
||||
.into()),
|
||||
}
|
||||
}
|
||||
Expr::UnaryOp { op, rhs, .. } => {
|
||||
|
|
Loading…
Reference in a new issue