[C++11] Change DebugInfoFinder to use range-based loops

Also changes the iterators to return actual DI type over MDNode.

llvm-svn: 204130
This commit is contained in:
Alon Mishne
2014-03-18 09:41:07 +00:00
parent aa5b5f7b0d
commit ad312155a6
8 changed files with 66 additions and 74 deletions

View File

@@ -56,31 +56,27 @@ bool ModuleDebugInfoPrinter::runOnModule(Module &M) {
}
void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
for (DebugInfoFinder::iterator I = Finder.compile_unit_begin(),
E = Finder.compile_unit_end(); I != E; ++I) {
for (DICompileUnit CU : Finder.compile_units()) {
O << "Compile Unit: ";
DICompileUnit(*I).print(O);
CU.print(O);
O << '\n';
}
for (DebugInfoFinder::iterator I = Finder.subprogram_begin(),
E = Finder.subprogram_end(); I != E; ++I) {
for (DISubprogram S : Finder.subprograms()) {
O << "Subprogram: ";
DISubprogram(*I).print(O);
S.print(O);
O << '\n';
}
for (DebugInfoFinder::iterator I = Finder.global_variable_begin(),
E = Finder.global_variable_end(); I != E; ++I) {
for (DIGlobalVariable GV : Finder.global_variables()) {
O << "GlobalVariable: ";
DIGlobalVariable(*I).print(O);
GV.print(O);
O << '\n';
}
for (DebugInfoFinder::iterator I = Finder.type_begin(),
E = Finder.type_end(); I != E; ++I) {
for (DIType T : Finder.types()) {
O << "Type: ";
DIType(*I).print(O);
T.print(O);
O << '\n';
}
}