diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-04-24 12:46:44 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-04-24 12:46:44 +0000 |
commit | 3fbee010c6b55fda1e34b424e331e418c96e917f (patch) | |
tree | dad5c9d7881ff6185f3dbc05dd9b32e086d54b71 /clang/test/Format | |
parent | 368d97e33c831a4820ce2e69ed0763ead6afc05a (diff) | |
download | bcm5719-llvm-3fbee010c6b55fda1e34b424e331e418c96e917f.tar.gz bcm5719-llvm-3fbee010c6b55fda1e34b424e331e418c96e917f.zip |
clang-format support for multiple input files.
Summary:
Added support for multiple input files, that can be used both with and
without in-place edit (-i) option. Added checks for -offset and -length options:
don't allow them on multiple files, check that they don't fall outside input
file, made both options unsigned, so that there's no need to check for negative
values. Removed "-1 can be used for end-of-file" from -length description.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D719
llvm-svn: 180185
Diffstat (limited to 'clang/test/Format')
-rw-r--r-- | clang/test/Format/multiple-inputs-error.cpp | 6 | ||||
-rw-r--r-- | clang/test/Format/multiple-inputs-inplace.cpp | 8 | ||||
-rw-r--r-- | clang/test/Format/multiple-inputs.cpp | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Format/multiple-inputs-error.cpp b/clang/test/Format/multiple-inputs-error.cpp new file mode 100644 index 00000000000..71f87e0b15b --- /dev/null +++ b/clang/test/Format/multiple-inputs-error.cpp @@ -0,0 +1,6 @@ +// RUN: cp %s %t-1.cpp +// RUN: cp %s %t-2.cpp +// RUN: clang-format 2>&1 >/dev/null -offset=1 -length=0 %t-1.cpp %t-2.cpp |FileCheck %s +// CHECK: error: "-offset" and "-length" can only be used for single file. + +int i ; diff --git a/clang/test/Format/multiple-inputs-inplace.cpp b/clang/test/Format/multiple-inputs-inplace.cpp new file mode 100644 index 00000000000..74c30db71eb --- /dev/null +++ b/clang/test/Format/multiple-inputs-inplace.cpp @@ -0,0 +1,8 @@ +// RUN: cp %s %t-1.cpp +// RUN: cp %s %t-2.cpp +// RUN: clang-format -style=LLVM -i %t-1.cpp %t-2.cpp +// RUN: FileCheck -strict-whitespace -input-file=%t-1.cpp %s +// RUN: FileCheck -strict-whitespace -input-file=%t-2.cpp %s + +// CHECK: {{^int\ \*i;}} + int * i ; diff --git a/clang/test/Format/multiple-inputs.cpp b/clang/test/Format/multiple-inputs.cpp new file mode 100644 index 00000000000..df267149fe5 --- /dev/null +++ b/clang/test/Format/multiple-inputs.cpp @@ -0,0 +1,7 @@ +// RUN: cp %s %t-1.cpp +// RUN: cp %s %t-2.cpp +// RUN: clang-format -style=LLVM %t-1.cpp %t-2.cpp|FileCheck -strict-whitespace %s + +// CHECK: {{^int\ \*i;}} +// CHECK: {{^int\ \*i;}} + int * i ; |