diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-19 09:28:55 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-19 09:28:55 +0000 |
commit | 58f427ee41fc0623c68b0d777b973339fbe73a26 (patch) | |
tree | 33e71c147da3cf76b77511a1fb7b49bee9b05719 /clang/lib/Format/Format.cpp | |
parent | ea61d08185b8c143d8bb6f625d8c4ed8035c8bd5 (diff) | |
download | bcm5719-llvm-58f427ee41fc0623c68b0d777b973339fbe73a26.tar.gz bcm5719-llvm-58f427ee41fc0623c68b0d777b973339fbe73a26.zip |
Fix bug in LineState comparison function.
The key bug was
if (Other.StartOfLineLevel < StartOfLineLevel) ..
instead of
if (Other.StartOfLineLevel != StartOfLineLevel) ..
Also cleaned up the function to be more consistent in the comparisons.
llvm-svn: 175500
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index d8ef5cf785c..8421a3b63e4 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -394,20 +394,20 @@ private: /// \brief Comparison operator to be able to used \c LineState in \c map. bool operator<(const LineState &Other) const { - if (Other.NextToken != NextToken) - return Other.NextToken > NextToken; - if (Other.Column != Column) - return Other.Column > Column; - if (Other.VariablePos != VariablePos) - return Other.VariablePos < VariablePos; - if (Other.LineContainsContinuedForLoopSection != - LineContainsContinuedForLoopSection) + if (NextToken != Other.NextToken) + return NextToken < Other.NextToken; + if (Column != Other.Column) + return Column < Other.Column; + if (VariablePos != Other.VariablePos) + return VariablePos < Other.VariablePos; + if (LineContainsContinuedForLoopSection != + Other.LineContainsContinuedForLoopSection) return LineContainsContinuedForLoopSection; - if (Other.ParenLevel != ParenLevel) - return Other.ParenLevel < ParenLevel; - if (Other.StartOfLineLevel < StartOfLineLevel) - return Other.StartOfLineLevel < StartOfLineLevel; - return Other.Stack < Stack; + if (ParenLevel != Other.ParenLevel) + return ParenLevel < Other.ParenLevel; + if (StartOfLineLevel != Other.StartOfLineLevel) + return StartOfLineLevel < Other.StartOfLineLevel; + return Stack < Other.Stack; } }; |