Struct Types inside other struct types (original) (raw)
Does llvm allow type descriptions (for structs) with other struct types embedded?
or does it have to be a pointer for any non primitive type?
Afaic, starting llvm17, all pointers are untyped. So if the above is tru, that means that any struct is a collection of various numeric types and “ptrType”, basically?
nikic May 6, 2025, 8:32pm 2
Possibly I’m misunderstanding the question, but structs can be nested. You can have something like { i8, { i32, ptr } }
. Or %struct1 = type { i8, %struct2 }
with identified structs.
Just to clarify – struct types, right?
so I can have a type that is { i32, %struct2 }, meaning that it holds a thing of type struct2 by value.
nikic May 6, 2025, 9:22pm 4
Yes.
Great, thank you.
Note for future learners – chatGPT is gaslighting you, this here is the correct answer (I also had indirect evidence of this, but wanted to make sure)