diff options
author | Tobias Grosser <tobias@grosser.es> | 2014-03-02 17:05:27 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2014-03-02 17:05:27 +0000 |
commit | b5846f9e1568c9e08b22380970d012db62cbb0bb (patch) | |
tree | b8c1d1021bd4b717555928f592ce7d12cd5324eb | |
parent | 45bac0d953c8cfa466af4dc11c6626382f25de0e (diff) | |
download | bcm5719-llvm-b5846f9e1568c9e08b22380970d012db62cbb0bb.tar.gz bcm5719-llvm-b5846f9e1568c9e08b22380970d012db62cbb0bb.zip |
ScopDetect: Make foreachs 'const auto &'
We mostly iterate over read-only values. Following a suggestion by Duncan P.N
Exons Smith, we use the construct 'const auto &' for this.
llvm-svn: 202651
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 454bb99510c..a5cfc2c1aa6 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -332,7 +332,7 @@ std::string ScopDetection::formatInvalidAlias(AliasSet &AS) const { std::vector<Value *> Pointers; - for (auto I : AS) + for (const auto &I : AS) Pointers.push_back(I.getValue()); std::sort(Pointers.begin(), Pointers.end()); @@ -607,7 +607,7 @@ static bool regionWithoutLoops(Region &R, LoopInfo *LI) { static unsigned eraseAllChildren(std::set<const Region *> &Regs, const Region *R) { unsigned Count = 0; - for (auto SubRegion : *R) { + for (const auto &SubRegion : *R) { if (Regs.find(SubRegion) != Regs.end()) { ++Count; Regs.erase(SubRegion); @@ -633,7 +633,7 @@ void ScopDetection::findScops(Region &R) { InvalidRegions[&R] = LastFailure; - for (auto SubRegion : R) + for (const auto &SubRegion : R) findScops(*SubRegion); // Try to expand regions. @@ -644,10 +644,10 @@ void ScopDetection::findScops(Region &R) { std::vector<Region *> ToExpand; - for (auto SubRegion : R) + for (const auto &SubRegion : R) ToExpand.push_back(SubRegion); - for (auto CurrentRegion : ToExpand) { + for (const auto &CurrentRegion : ToExpand) { // Skip invalid regions. Regions may become invalid, if they are element of // an already expanded region. if (ValidRegions.find(CurrentRegion) == ValidRegions.end()) @@ -800,7 +800,7 @@ void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin, } void ScopDetection::printLocations(llvm::Function &F) { - for (auto R : *this) { + for (const auto &R : *this) { unsigned LineEntry, LineExit; std::string FileName; @@ -846,7 +846,7 @@ void polly::ScopDetection::verifyAnalysis() const { if (!VerifyScops) return; - for (auto R : ValidRegions) + for (const auto &R : ValidRegions) verifyRegion(*R); } @@ -862,7 +862,7 @@ void ScopDetection::getAnalysisUsage(AnalysisUsage &AU) const { } void ScopDetection::print(raw_ostream &OS, const Module *) const { - for (auto R : ValidRegions) + for (const auto &R : ValidRegions) OS << "Valid Region for Scop: " << R->getNameStr() << '\n'; OS << "\n"; |