summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-21 23:59:16 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-21 23:59:16 +0000
commit32854e272746fd97870276bb70740d0a7f9e6341 (patch)
tree68e92f6b4108e8f34f1c94221c4265ae7da6631e /llvm/lib/VMCore/Module.cpp
parent46cb6f1b51d0f54a133995f31cb98f110ac69b81 (diff)
downloadbcm5719-llvm-32854e272746fd97870276bb70740d0a7f9e6341.tar.gz
bcm5719-llvm-32854e272746fd97870276bb70740d0a7f9e6341.zip
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. llvm-svn: 155300
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r--llvm/lib/VMCore/Module.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp
index 3c67191e09c..24c2707b543 100644
--- a/llvm/lib/VMCore/Module.cpp
+++ b/llvm/lib/VMCore/Module.cpp
@@ -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);
}
OpenPOWER on IntegriCloud