summaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-08-25 20:30:43 +0000
committerHans Wennborg <hans@hanshq.net>2017-08-25 20:30:43 +0000
commit16b04ba2571e9fd5f76cfa12666fcf8e95c30d75 (patch)
tree3f824bfa6dbb1ec7f8b71e0a190f75818ad506cb /clang/unittests/Format/FormatTest.cpp
parent6493242f866bd81de5bbd82becb1fcd143ae3e1a (diff)
downloadllvmorg-5.0.0-rc3.tar.gz
Merging r311792:llvmorg-5.0.0-rc3
------------------------------------------------------------------------ r311792 | djasper | 2017-08-25 12:14:53 -0700 (Fri, 25 Aug 2017) | 9 lines [Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for alignments Indent should be compared before nesting level to determine if a token is on the same scope as the one we align with. Because it was inverted, clang-format sometimes tried to align tokens with tokens from outer scopes, causing the assert(Shift >= 0) to fire. This fixes bug #33507. Patch by Beren Minor, thank you! ------------------------------------------------------------------------ llvm-svn: 311800
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index f533ebf2234b..570f3472bcef 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8860,6 +8860,16 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
Alignment);
Alignment.BinPackParameters = true;
Alignment.ColumnLimit = 80;
+
+ // Bug 33507
+ Alignment.PointerAlignment = FormatStyle::PAS_Middle;
+ verifyFormat(
+ "auto found = range::find_if(vsProducts, [&](auto * aProduct) {\n"
+ " static const Version verVs2017;\n"
+ " return true;\n"
+ "});\n",
+ Alignment);
+ Alignment.PointerAlignment = FormatStyle::PAS_Right;
}
TEST_F(FormatTest, LinuxBraceBreaking) {