[LLVMdev] Iterate through a Module's StructTypes

Nick Lewycky nicholas at mxc.ca
Sun Oct 20 12:57:16 PDT 2013


Chunbai YANG wrote:
> Hello,
>
> I'm updating a legacy code using LLVM 2.5 where it has an iteration
> through a Module's TypeSymbolTable to process each StructType.
>
> In LLVM 3.4, TypeSymbolTable has been removed. I can only find the
> LLVMContextImpl instance of a Module's LLVMContext which has
> AnonStructTypes and NamedStructTypes two maps. However, LLVMContextImpl
> is an opaque class which cannot be directly accessed by my code(a
> subclass of ModulePass).
>
> So how can I iterate all the Types in a Module? Thanks.

See the llvm::TypeFinder class in include/llvm/IR/TypeFinder.h.
http://llvm.org/doxygen/classllvm_1_1TypeFinder.html

Nick



More information about the llvm-dev mailing list