File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,30 @@ void FindUsedTypes::IncorporateType(const Type *Ty) {
41
41
IncorporateType (*I);
42
42
}
43
43
44
+ void FindUsedTypes::IncorporateSymbolTable (const SymbolTable &ST) {
45
+ SymbolTable::const_iterator TI = ST.find (Type::TypeTy);
46
+ if (TI == ST.end ()) return ; // No named types
47
+
48
+ for (SymbolTable::type_const_iterator I = TI->second .begin (),
49
+ E = TI->second .end (); I != E; ++I)
50
+ IncorporateType (cast<Type>(I->second ));
51
+ }
44
52
45
53
// run - This incorporates all types used by the specified module
46
54
//
47
55
bool FindUsedTypes::run (Module &m) {
48
56
UsedTypes.clear (); // reset if run multiple times...
49
57
58
+ IncorporateSymbolTable (m.getSymbolTable ());
59
+
50
60
// Loop over global variables, incorporating their types
51
61
for (Module::const_giterator I = m.gbegin (), E = m.gend (); I != E; ++I)
52
62
IncorporateType (I->getType ());
53
63
54
64
for (Module::iterator MI = m.begin (), ME = m.end (); MI != ME; ++MI) {
55
65
IncorporateType (MI->getType ());
56
66
const Function &F = *MI;
67
+ IncorporateSymbolTable (F.getSymbolTable ());
57
68
58
69
// Loop over all of the instructions in the function, adding their return
59
70
// type as well as the types of their operands.
You can’t perform that action at this time.
0 commit comments