Do not consider comments when adjusting to local indent style.
Before (when only reformatting "int b"):
int a; // comment
// comment
int b;
After:
int a; // comment
// comment
int b;
This also fixes llvm.org/PR15433.
llvm-svn: 177524
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 7f9cecb..40f0953 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3279,6 +3279,13 @@
format("void f() {}\n"
"void g() {}",
13, 0, getLLVMStyle()));
+ EXPECT_EQ("int a; // comment\n"
+ " // line 2\n"
+ "int b;",
+ format("int a; // comment\n"
+ " // line 2\n"
+ " int b;",
+ 35, 0, getLLVMStyle()));
}
TEST_F(FormatTest, BreakStringLiterals) {