diff options
| author | Daniel Jasper <djasper@google.com> | 2013-12-17 12:38:55 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-12-17 12:38:55 +0000 |
| commit | bad63ae2a59d03352896f7c58fbf7eb9f9197b7b (patch) | |
| tree | 23be81d7909016100983e8f5aaeaf55259d2f810 /clang/unittests/Format/FormatTest.cpp | |
| parent | 33a2cc1e10402747a42a28ba8cc1998ba5c36cce (diff) | |
| download | bcm5719-llvm-bad63ae2a59d03352896f7c58fbf7eb9f9197b7b.tar.gz bcm5719-llvm-bad63ae2a59d03352896f7c58fbf7eb9f9197b7b.zip | |
clang-format: Don't adapt local format to macros.
Formatting this:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
Before:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
After:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
llvm-svn: 197494
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index e9b2a9c9add..b6c96041469 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3149,7 +3149,7 @@ TEST_F(FormatTest, BreaksDesireably) { " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); - // Indent consistently indenpendent of call expression. + // Indent consistently independent of call expression. verifyFormat("aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(\n" " dddddddddddddddddddddddddddddd));\n" "aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(\n" @@ -5959,6 +5959,29 @@ TEST_F(FormatTest, ReformatRegionAdjustsIndent) { format(" int a;\n" "void ffffff() {}", 11, 0, getLLVMStyleWithColumns(11))); + + EXPECT_EQ(" void f() {\n" + "#define A 1\n" + " }", + format(" void f() {\n" + " #define A 1\n" // Format this line. + " }", + 20, 0, getLLVMStyle())); + EXPECT_EQ(" void f() {\n" + " int i;\n" + "#define A \\\n" + " int i; \\\n" + " int j;\n" + " int k;\n" + " }", + format(" void f() {\n" + " int i;\n" + "#define A \\\n" + " int i; \\\n" + " int j;\n" + " int k;\n" // Format this line. + " }", + 67, 0, getLLVMStyle())); } TEST_F(FormatTest, BreakStringLiterals) { |

