summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-02-11 12:33:24 +0000
committerManuel Klimek <klimek@google.com>2013-02-11 12:33:24 +0000
commit0c13795f68a3d2fe0bc31650260809ad8f160a3b (patch)
treefd19c182cd4fb1121815f48e829a12f59910d35a /clang/unittests
parente2067788338f887024adc3df824252a03730147a (diff)
downloadbcm5719-llvm-0c13795f68a3d2fe0bc31650260809ad8f160a3b.tar.gz
bcm5719-llvm-0c13795f68a3d2fe0bc31650260809ad8f160a3b.zip
Fixes handling of empty lines in macros.
Now correctly formats: #define A \ \ b; to #define A b; Added the state whether an unwrapped line is a macro to the debug output. llvm-svn: 174878
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 1865b5059c4..83e4fc54e39 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -858,6 +858,26 @@ TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) {
verifyFormat("#define A (1)");
}
+TEST_F(FormatTest, EmptyLinesInMacroDefinitions) {
+ EXPECT_EQ("#define A b;", format("#define A \\\n"
+ " \\\n"
+ " b;", getLLVMStyleWithColumns(25)));
+ EXPECT_EQ("#define A \\\n"
+ " \\\n"
+ " a; \\\n"
+ " b;", format("#define A \\\n"
+ " \\\n"
+ " a; \\\n"
+ " b;", getLLVMStyleWithColumns(11)));
+ EXPECT_EQ("#define A \\\n"
+ " a; \\\n"
+ " \\\n"
+ " b;", format("#define A \\\n"
+ " a; \\\n"
+ " \\\n"
+ " b;", getLLVMStyleWithColumns(11)));
+}
+
TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) {
EXPECT_EQ("{\n {\n#define A\n }\n}", format("{{\n#define A\n}}"));
}
OpenPOWER on IntegriCloud