func (v *Codegen) structTypeToLLVMType(typ *parser.StructType) llvm.Type { if t, ok := v.structLookup_UseHelperFunction[typ]; ok { return t } return llvm.StructType(v.structTypeToLLVMTypeFields(typ), typ.Attrs().Contains("packed")) }
func (v *AttributeCheck) CheckStructType(s *SemanticAnalyzer, n parser.StructType) { for _, attr := range n.Attrs() { switch attr.Key { case "packed": if attr.Value != "" { s.Err(attr, "Struct attribute `%s` doesn't expect value", attr.Key) } case "deprecated": // value is optional, nothing to check default: s.Err(attr, "Invalid struct attribute key `%s`", attr.Key) } } }
func (v *Codegen) addStructType(typ parser.StructType, name string) { if _, ok := v.namedTypeLookup[name]; ok { return } structure := v.curFile.LlvmModule.Context().StructCreateNamed(name) v.namedTypeLookup[name] = structure for _, field := range typ.Variables { if named, ok := field.Variable.Type.(*parser.NamedType); ok { v.addNamedType(named) } } structure.StructSetBody(v.structTypeToLLVMTypeFields(typ), typ.Attrs().Contains("packed")) }
func (v *Codegen) structTypeToLLVMType(typ parser.StructType) llvm.Type { return llvm.StructType(v.structTypeToLLVMTypeFields(typ), typ.Attrs().Contains("packed")) }