summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-07-12 15:21:43 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-07-12 15:21:43 +0000
commite092634f31afdf0fa5f82d81223d4726cfc7c537 (patch)
tree8a4795489b51dd1e187e96ff26fd489e5b128688 /clang/unittests/Format/FormatTest.cpp
parent8c804d97467964bee14f47c72ec6b89f8d231f99 (diff)
downloadbcm5719-llvm-e092634f31afdf0fa5f82d81223d4726cfc7c537.tar.gz
bcm5719-llvm-e092634f31afdf0fa5f82d81223d4726cfc7c537.zip
[clang-format] Keep level of comment before an empty line
Summary: This patch fixes bug https://bugs.llvm.org/show_bug.cgi?id=3313: a comment line was aligned with the next #ifdef even in the presence of an empty line between them. Reviewers: djasper, klimek Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35296 llvm-svn: 307795
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b5f959f9c1f..937362f5c9d 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -825,12 +825,35 @@ TEST_F(FormatTest, FormatsSwitchStatement) {
" case A:\n"
" f();\n"
" break;\n"
- " // On B:\n"
+ " // fallthrough\n"
" case B:\n"
" g();\n"
" break;\n"
" }\n"
"});");
+ EXPECT_EQ("DEBUG({\n"
+ " switch (x) {\n"
+ " case A:\n"
+ " f();\n"
+ " break;\n"
+ " // On B:\n"
+ " case B:\n"
+ " g();\n"
+ " break;\n"
+ " }\n"
+ "});",
+ format("DEBUG({\n"
+ " switch (x) {\n"
+ " case A:\n"
+ " f();\n"
+ " break;\n"
+ " // On B:\n"
+ " case B:\n"
+ " g();\n"
+ " break;\n"
+ " }\n"
+ "});",
+ getLLVMStyle()));
verifyFormat("switch (a) {\n"
"case (b):\n"
" return;\n"
OpenPOWER on IntegriCloud