This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.
llvm-svn: 253202
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
This makes the format tests look more like most other FileCheck tests in clang.
The multiple-inputs tests still use temp files, to make sure that the file
input code in clang-format stays tested.
Stop stripping out the comment lines in style-on-command-line.cpp as they don't
get in the way and it makes the test simpler. Also remove 2>&1s on the tests in
that file that don't need it.
http://reviews.llvm.org/D13852
llvm-svn: 250706
This reverts commit 236854, which caused clang-format to always print
'{ "IncompleteFormat": false }' at the top of an incompletely formatted file.
This output causes problems e.g. in Polly's automatic formatting checks. Daniel
tried to fix this in 236867, but this fix had to be reverted due to buildbot
failures. I revert this change as well for now as it is Friday night and
unlikely to be fixed immediately.
llvm-svn: 236908
Propagate the 'incomplete-format' state back through clang-format's command
line interace and adapt the emacs integration to show a better result.
llvm-svn: 236854
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.
This reverts commit r213150.
Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."
This reverts commit r213148.
Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"
This reverts commit r213146.
llvm-svn: 213159
This is failing for me. When I run the command on my own, I get this:
Error reading /usr/local/google/home/morbo/llvm/llvm.obj/tools/clang/test/Format/Output/.clang-format: Invalid argument
void f() {
int* i;
int j;
}
The formatting is like this because I have the Google format version in my
~/.clang-format file. This test should be made independent of that.
llvm-svn: 195080
Dotfiles are impractical on Windows. This makes clang-format search
for the style configuration file as '_clang-format' in addition to
the usual '.clang-format'. This is similar to how VIM searches for
'_vimrc' on Windows.
Differential Revision: http://llvm-reviews.chandlerc.com/D1629
llvm-svn: 190413
fallback syntax used when we fail to find a '.clang-format' file. Adjust
variable names appropriately.
Update the editor integration pieces that specify a '-style' option to
specify it as '-style=file'. I left the functionality in place because
even if the preferred method is to use '.clang-format' files, this way
if someone needs to clobber the style in their editor we show how to do
so in these examples.
Also check in a '.clang-format' file for Clang to ensure that separate
checkouts and builds of Clang from LLVM can still get the nice
formatting. =] This unfortunately required nuking the test for the
absence of a '.clang-format' file as now the directory happening to be
under your clang source tree will cause there to always be a file. ;]
llvm-svn: 189741
With this patch, clang-format will try to keep the cursor at the
original code position in editor integrations (implemented for emacs and
vim). This means, after formatting, clang-format will try to keep the
cursor on the same character of the same token.
llvm-svn: 182373
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
The new emacs integration is simpler, does not save the current file
before reformatting and ensures that emacs does not scroll as a result
of formatting.
Also explicitly set the style in clang-format tests to make them more
robust.
llvm-svn: 179372