mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-03 11:24:18 +00:00
Add a flag to the struct type finder to collect only those types which have
names. This saves collecting types we normally don't care about. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -483,9 +483,10 @@ namespace {
|
||||
DenseSet<Type*> VisitedTypes;
|
||||
|
||||
std::vector<StructType*> &StructTypes;
|
||||
bool OnlyNamed;
|
||||
public:
|
||||
TypeFinder(std::vector<StructType*> &structTypes)
|
||||
: StructTypes(structTypes) {}
|
||||
TypeFinder(std::vector<StructType*> &structTypes, bool onlyNamed)
|
||||
: StructTypes(structTypes), OnlyNamed(onlyNamed) {}
|
||||
|
||||
void run(const Module &M) {
|
||||
// Get types from global variables.
|
||||
@ -545,7 +546,8 @@ namespace {
|
||||
|
||||
// If this is a structure or opaque type, add a name for the type.
|
||||
if (StructType *STy = dyn_cast<StructType>(Ty))
|
||||
StructTypes.push_back(STy);
|
||||
if (!OnlyNamed || STy->hasName())
|
||||
StructTypes.push_back(STy);
|
||||
|
||||
// Recursively walk all contained types.
|
||||
for (Type::subtype_iterator I = Ty->subtype_begin(),
|
||||
@ -590,6 +592,7 @@ namespace {
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
void Module::findUsedStructTypes(std::vector<StructType*> &StructTypes) const {
|
||||
TypeFinder(StructTypes).run(*this);
|
||||
void Module::findUsedStructTypes(std::vector<StructType*> &StructTypes,
|
||||
bool OnlyNamed) const {
|
||||
TypeFinder(StructTypes, OnlyNamed).run(*this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user