//===- TypeFinder.cpp - Implement the TypeFinder class --------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the TypeFinder class for the IR library. // //===----------------------------------------------------------------------===// #include "llvm/IR/TypeFinder.h" #include "llvm/ADT/SmallVector.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constant.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/IR/Type.h" #include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" #include <utility> usingnamespacellvm; void TypeFinder::run(const Module &M, bool onlyNamed) { … } void TypeFinder::clear() { … } /// incorporateType - This method adds the type to the list of used structures /// if it's not in there already. void TypeFinder::incorporateType(Type *Ty) { … } /// incorporateValue - This method is used to walk operand lists finding types /// hiding in constant expressions and other operands that won't be walked in /// other ways. GlobalValues, basic blocks, instructions, and inst operands are /// all explicitly enumerated. void TypeFinder::incorporateValue(const Value *V) { … } /// incorporateMDNode - This method is used to walk the operands of an MDNode to /// find types hiding within. void TypeFinder::incorporateMDNode(const MDNode *V) { … } void TypeFinder::incorporateAttributes(AttributeList AL) { … }