summaryrefslogtreecommitdiffstats
path: root/clang/test/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-10-28 01:08:22 +0000
committerDaniel Jasper <djasper@google.com>2015-10-28 01:08:22 +0000
commita1036e5d081dd800c71bdbdf858908b99eed03a4 (patch)
treeb35dd26dec1d3ae5090e6e51389e3c42670af6b3 /clang/test/Format
parentf6bd01097a04635343c97818d157450a8df863b9 (diff)
downloadbcm5719-llvm-a1036e5d081dd800c71bdbdf858908b99eed03a4.tar.gz
bcm5719-llvm-a1036e5d081dd800c71bdbdf858908b99eed03a4.zip
clang-format: When a line is formatted, also format subsequence lines if their indent is off.
Summary: This is especially important so that if a change is solely inserting a block around a few statements, clang-format-diff.py will still clean up and add indentation to the inner parts. Reviewers: klimek Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D14105 llvm-svn: 251474
Diffstat (limited to 'clang/test/Format')
-rw-r--r--clang/test/Format/adjust-indent.cpp10
-rw-r--r--clang/test/Format/line-ranges.cpp8
-rw-r--r--clang/test/Format/ranges.cpp10
3 files changed, 19 insertions, 9 deletions
diff --git a/clang/test/Format/adjust-indent.cpp b/clang/test/Format/adjust-indent.cpp
new file mode 100644
index 00000000000..5565dc00b62
--- /dev/null
+++ b/clang/test/Format/adjust-indent.cpp
@@ -0,0 +1,10 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -lines=2:2 \
+// RUN: | FileCheck -strict-whitespace %s
+
+void f() {
+// CHECK: void f() {
+int i;
+// CHECK: {{^ int\ i;}}
+ int j;
+// CHECK: {{^ int\ j;}}
+}
diff --git a/clang/test/Format/line-ranges.cpp b/clang/test/Format/line-ranges.cpp
index 9099022b428..e81e9624344 100644
--- a/clang/test/Format/line-ranges.cpp
+++ b/clang/test/Format/line-ranges.cpp
@@ -4,8 +4,8 @@
// CHECK: {{^int\ \*i;$}}
int*i;
-// CHECK: {{^\ \ int\ \ \*\ \ i;$}}
- int * i;
+// CHECK: {{^int\ \ \*\ \ i;$}}
+int * i;
-// CHECK: {{^\ \ int\ \*i;$}}
- int * i;
+// CHECK: {{^int\ \*i;$}}
+int * i;
diff --git a/clang/test/Format/ranges.cpp b/clang/test/Format/ranges.cpp
index ace528a9166..66b984e037b 100644
--- a/clang/test/Format/ranges.cpp
+++ b/clang/test/Format/ranges.cpp
@@ -2,10 +2,10 @@
// RUN: | clang-format -style=LLVM -offset=2 -length=0 -offset=28 -length=0 \
// RUN: | FileCheck -strict-whitespace %s
// CHECK: {{^int\ \*i;$}}
- int*i;
+int*i;
-// CHECK: {{^\ \ int\ \ \*\ \ i;$}}
- int * i;
+// CHECK: {{^int\ \ \*\ \ i;$}}
+int * i;
-// CHECK: {{^\ \ int\ \*i;$}}
- int * i;
+// CHECK: {{^int\ \*i;$}}
+int * i;
OpenPOWER on IntegriCloud