r230395 - clang-format: Change location of stashed token
Nico Weber
thakis at chromium.org
Tue Feb 24 17:18:38 PST 2015
When landing patches, please put the whole change description in the commit
message. It's ok to also have a link to the review URL, but the commit
message should be self-contained and shouldn't require people to click
through to phab.
On Tue, Feb 24, 2015 at 3:23 PM, Jacques Pienaar <jpienaar at google.com>
wrote:
> 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"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150224/51a9ee33/attachment.html>
More information about the cfe-commits
mailing list