Modifying Named Structure Types


I am trying to write a module pass that traverses through named structure types defined and modifies the type of certain fields in these named types. Is there any simple way of doing this? I am not quite sure how to get the LLVMContext’s pImpl working from a pass since LLVMContextImpl is forward-declared.


Mutating types is unsupported, and generally a bad idea. Make a new
named type, then replace all the values which use that type with
values which use the new type.


Is there a way of iterating through all the named types, or do I instead need to make new named types as I encounter them?