diff options
author | Tobias Grosser <tobias@grosser.es> | 2014-03-03 13:00:39 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2014-03-03 13:00:39 +0000 |
commit | 4abf9d3a5451474889e6cfaf0c53e05f4cb8c42b (patch) | |
tree | 6a0e857c273df179655664a21a7f1b1a86fadda5 /llvm/lib/Analysis | |
parent | 0df3a5688cfa18e7ec69bd70803e39773215a4fa (diff) | |
download | bcm5719-llvm-4abf9d3a5451474889e6cfaf0c53e05f4cb8c42b.tar.gz bcm5719-llvm-4abf9d3a5451474889e6cfaf0c53e05f4cb8c42b.zip |
[C++11] Add a basic block range view for RegionInfo
This also switches the users in LLVM to ensure this functionality is tested.
llvm-svn: 202705
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/RegionInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/RegionPass.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Analysis/RegionPrinter.cpp | 7 |
3 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/RegionInfo.cpp b/llvm/lib/Analysis/RegionInfo.cpp index 876d86b785b..f4da598d844 100644 --- a/llvm/lib/Analysis/RegionInfo.cpp +++ b/llvm/lib/Analysis/RegionInfo.cpp @@ -438,8 +438,8 @@ void Region::print(raw_ostream &OS, bool print_tree, unsigned level, OS.indent(level*2 + 2); if (Style == PrintBB) { - for (const_block_iterator I = block_begin(), E = block_end(); I != E; ++I) - OS << (*I)->getName() << ", "; // TODO: remove the last "," + for (const auto &BB : blocks()) + OS << BB->getName() << ", "; // TODO: remove the last "," } else if (Style == PrintRN) { for (const_element_iterator I = element_begin(), E = element_end(); I!=E; ++I) OS << **I << ", "; // TODO: remove the last ", diff --git a/llvm/lib/Analysis/RegionPass.cpp b/llvm/lib/Analysis/RegionPass.cpp index 9208fa21d7e..ac4e1149f08 100644 --- a/llvm/lib/Analysis/RegionPass.cpp +++ b/llvm/lib/Analysis/RegionPass.cpp @@ -195,9 +195,8 @@ public: virtual bool runOnRegion(Region *R, RGPassManager &RGM) { Out << Banner; - for (Region::block_iterator I = R->block_begin(), E = R->block_end(); - I != E; ++I) - (*I)->print(Out); + for (const auto &BB : R->blocks()) + BB->print(Out); return false; } diff --git a/llvm/lib/Analysis/RegionPrinter.cpp b/llvm/lib/Analysis/RegionPrinter.cpp index c5f1b925921..6467f47cfbd 100644 --- a/llvm/lib/Analysis/RegionPrinter.cpp +++ b/llvm/lib/Analysis/RegionPrinter.cpp @@ -121,11 +121,10 @@ struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> { RegionInfo *RI = R->getRegionInfo(); - for (Region::const_block_iterator BI = R->block_begin(), - BE = R->block_end(); BI != BE; ++BI) - if (RI->getRegionFor(*BI) == R) + for (const auto &BB : R->blocks()) + if (RI->getRegionFor(BB) == R) O.indent(2 * (depth + 1)) << "Node" - << static_cast<const void*>(RI->getTopLevelRegion()->getBBNode(*BI)) + << static_cast<const void*>(RI->getTopLevelRegion()->getBBNode(BB)) << ";\n"; O.indent(2 * depth) << "}\n"; |