Make strings constant

For some reason this was disabled.
This commit is contained in:
Ayke van Laethem
2018-08-24 05:18:16 +02:00
parent f49ceddd73
commit 9b4ac0459b
+1 -1
View File
@@ -1990,7 +1990,7 @@ func (c *Compiler) parseConst(expr *ssa.Const) (llvm.Value, error) {
global := llvm.AddGlobal(c.mod, llvm.ArrayType(llvm.Int8Type(), len(str)), ".str")
global.SetInitializer(c.ctx.ConstString(str, false))
global.SetLinkage(llvm.PrivateLinkage)
global.SetGlobalConstant(false)
global.SetGlobalConstant(true)
zero := llvm.ConstInt(llvm.Int32Type(), 0, false)
strPtr := c.builder.CreateInBoundsGEP(global, []llvm.Value{zero, zero}, "")
strObj := llvm.ConstNamedStruct(c.mod.GetTypeByName("string"), []llvm.Value{strLen, strPtr})