r230395 - clang-format: Change location of stashed token
Jacques Pienaar
jpienaar at google.com
Tue Feb 24 15:23:24 PST 2015
Author: jpienaar
Date: Tue Feb 24 17:23:24 2015
New Revision: 230395
URL: http://llvm.org/viewvc/llvm-project?rev=230395&view=rev
Log:
clang-format: Change location of stashed token
Commit of patch in http://reviews.llvm.org/D7871
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=230395&r1=230394&r2=230395&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Feb 24 17:23:24 2015
@@ -940,11 +940,13 @@ private:
FormatTok = new (Allocator.Allocate()) FormatToken;
FormatTok->Tok = Tok;
SourceLocation TokLocation =
- FormatTok->Tok.getLocation().getLocWithOffset(1);
+ FormatTok->Tok.getLocation().getLocWithOffset(Tok.getLength() - 1);
+ FormatTok->Tok.setLocation(TokLocation);
FormatTok->WhitespaceRange = SourceRange(TokLocation, TokLocation);
FormatTok->TokenText = TokenText;
FormatTok->ColumnWidth = 1;
- FormatTok->OriginalColumn = OriginalColumn;
+ FormatTok->OriginalColumn = OriginalColumn + 1;
+
return FormatTok;
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=230395&r1=230394&r2=230395&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Feb 24 17:23:24 2015
@@ -9753,6 +9753,7 @@ TEST_F(FormatTest, TripleAngleBrackets)
TEST_F(FormatTest, MergeLessLessAtEnd) {
verifyFormat("<<");
+ EXPECT_EQ("< < <", format("\\\n<<<"));
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaallvm::outs() <<");
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
More information about the cfe-commits
mailing list