<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 19, 2013 at 1:28 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Tue Feb 19 03:28:55 2013<br>
New Revision: 175500<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175500&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175500&view=rev</a><br>
Log:<br>
Fix bug in LineState comparison function.<br>
<br>
The key bug was<br>
<br>
  if (Other.StartOfLineLevel < StartOfLineLevel) ..<br>
<br>
instead of<br>
<br>
  if (Other.StartOfLineLevel != StartOfLineLevel) ..<br>
<br>
Also cleaned up the function to be more consistent in the comparisons.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Format/Format.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/Format.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=175500&r1=175499&r2=175500&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=175500&r1=175499&r2=175500&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Format/Format.cpp (original)<br>
+++ cfe/trunk/lib/Format/Format.cpp Tue Feb 19 03:28:55 2013<br>
@@ -394,20 +394,20 @@ private:<br>
<br>
     /// \brief Comparison operator to be able to used \c LineState in \c map.<br>
     bool operator<(const LineState &Other) const {<br></blockquote><div><br></div><div style>I would've thought this whole thing would've been less error prone to write as:<br><br>return a < x.a &&</div>
<div style>   b < x.b &&</div><div style>   ...</div><div style><br></div><div style>is that not the case?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

-      if (Other.NextToken != NextToken)<br>
-        return Other.NextToken > NextToken;<br>
-      if (Other.Column != Column)<br>
-        return Other.Column > Column;<br>
-      if (Other.VariablePos != VariablePos)<br>
-        return Other.VariablePos < VariablePos;<br>
-      if (Other.LineContainsContinuedForLoopSection !=<br>
-          LineContainsContinuedForLoopSection)<br>
+      if (NextToken != Other.NextToken)<br>
+        return NextToken < Other.NextToken;<br>
+      if (Column != Other.Column)<br>
+        return Column < Other.Column;<br>
+      if (VariablePos != Other.VariablePos)<br>
+        return VariablePos < Other.VariablePos;<br>
+      if (LineContainsContinuedForLoopSection !=<br>
+          Other.LineContainsContinuedForLoopSection)<br>
         return LineContainsContinuedForLoopSection;<br>
-      if (Other.ParenLevel != ParenLevel)<br>
-        return Other.ParenLevel < ParenLevel;<br>
-      if (Other.StartOfLineLevel < StartOfLineLevel)<br>
-        return Other.StartOfLineLevel < StartOfLineLevel;<br>
-      return Other.Stack < Stack;<br>
+      if (ParenLevel != Other.ParenLevel)<br>
+        return ParenLevel < Other.ParenLevel;<br>
+      if (StartOfLineLevel != Other.StartOfLineLevel)<br>
+        return StartOfLineLevel < Other.StartOfLineLevel;<br>
+      return Stack < Other.Stack;<br>
     }<br>
   };<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>