clang-format: Don't accidentally move tokens into preprocessor directive.
This fixes llvm.org/PR17265.
Before:
Foo::Foo()
#ifdef BAR
: baz(0)
#endif {
}
After:
Foo::Foo()
#ifdef BAR
: baz(0)
#endif
{
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190861 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index c5d0171..fc13ad1 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -2226,6 +2226,12 @@
" andMoreParameters),\n"
" trailing);",
getLLVMStyleWithColumns(69));
+ verifyFormat("Foo::Foo()\n"
+ "#ifdef BAR\n"
+ " : baz(0)\n"
+ "#endif\n"
+ "{\n"
+ "}");
}
TEST_F(FormatTest, LayoutBlockInsideParens) {