<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 2, 2014 at 8:28 AM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: grosser<br>
Date: Sun Mar  2 10:28:24 2014<br>
New Revision: 202648<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=202648&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=202648&view=rev</a><br>
Log:<br>
PollyDectect: Use spaces before foreach colons<br>
<br>
clang-format requires a space before the ":" in the foreach loop. Even though<br>
this is surprising to me, we follow this style to make our formatting<br>
consistent with clang-format. I found that this clang-format style is used in a<br>
couple of C++11 examples, hence I believe the fact that clang-format adds a<br>
colon is not a bug but just something I was not used to yet.<br></blockquote><div><br></div><div>For what it's worth, I assume the nearest analogy (and only other context I recall ':' in like this) is for conditional operators ("x ? y : z") and inheritance ("struct foo : bar") - both of which also uses spaces on both sides of the ':'.<br>
<br>Just in case that helps provide developers with a good mental model of "space on both sides of a colon, even in a range based for".</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Modified:<br>
    polly/trunk/lib/Analysis/ScopDetection.cpp<br>
<br>
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=202648&r1=202647&r2=202648&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=202648&r1=202647&r2=202648&view=diff</a><br>

==============================================================================<br>
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)<br>
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sun Mar  2 10:28:24 2014<br>
@@ -332,7 +332,7 @@ std::string ScopDetection::formatInvalid<br>
<br>
   std::vector<Value *> Pointers;<br>
<br>
-  for (auto I: AS)<br>
+  for (auto I : AS)<br>
     Pointers.push_back(I.getValue());<br>
<br>
   std::sort(Pointers.begin(), Pointers.end());<br>
@@ -607,7 +607,7 @@ static bool regionWithoutLoops(Region &R<br>
 static unsigned eraseAllChildren(std::set<const Region *> &Regs,<br>
                                  const Region *R) {<br>
   unsigned Count = 0;<br>
-  for (auto SubRegion: *R) {<br>
+  for (auto SubRegion : *R) {<br>
     if (Regs.find(SubRegion) != Regs.end()) {<br>
       ++Count;<br>
       Regs.erase(SubRegion);<br>
@@ -633,7 +633,7 @@ void ScopDetection::findScops(Region &R)<br>
<br>
   InvalidRegions[&R] = LastFailure;<br>
<br>
-  for (auto SubRegion: R)<br>
+  for (auto SubRegion : R)<br>
     findScops(*SubRegion);<br>
<br>
   // Try to expand regions.<br>
@@ -644,10 +644,10 @@ void ScopDetection::findScops(Region &R)<br>
<br>
   std::vector<Region *> ToExpand;<br>
<br>
-  for (auto SubRegion: R)<br>
+  for (auto SubRegion : R)<br>
     ToExpand.push_back(SubRegion);<br>
<br>
-  for (auto CurrentRegion: ToExpand) {<br>
+  for (auto CurrentRegion : ToExpand) {<br>
     // Skip invalid regions. Regions may become invalid, if they are element of<br>
     // an already expanded region.<br>
     if (ValidRegions.find(CurrentRegion) == ValidRegions.end())<br>
@@ -800,7 +800,7 @@ void ScopDetection::getDebugLocation(con<br>
 }<br>
<br>
 void ScopDetection::printLocations(llvm::Function &F) {<br>
-  for (auto R: *this) {<br>
+  for (auto R : *this) {<br>
     unsigned LineEntry, LineExit;<br>
     std::string FileName;<br>
<br>
@@ -846,7 +846,7 @@ void polly::ScopDetection::verifyAnalysi<br>
   if (!VerifyScops)<br>
     return;<br>
<br>
-  for (auto R: ValidRegions)<br>
+  for (auto R : ValidRegions)<br>
     verifyRegion(*R);<br>
 }<br>
<br>
@@ -862,7 +862,7 @@ void ScopDetection::getAnalysisUsage(Ana<br>
 }<br>
<br>
 void ScopDetection::print(raw_ostream &OS, const Module *) const {<br>
-  for (auto R: ValidRegions)<br>
+  for (auto R : ValidRegions)<br>
     OS << "Valid Region for Scop: " << R->getNameStr() << '\n';<br>
<br>
   OS << "\n";<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>