#
13b97d8b |
| 13-May-2013 |
Manuel Klimek <klimek@google.com> |
Implements IndentWidth.
This is required for various styles that are for example based on 8-indent.
llvm-svn: 181690
|
#
b910bbb8 |
| 13-May-2013 |
Daniel Jasper <djasper@google.com> |
Assume macros to contain declarations.
This seems to be the vastly more common case. If we find enough examples to the contrary, we can make it smarter.
Before: #define MACRO void f(int * a) After:
Assume macros to contain declarations.
This seems to be the vastly more common case. If we find enough examples to the contrary, we can make it smarter.
Before: #define MACRO void f(int * a) After: #define MACRO void f(int *a) llvm-svn: 181687
show more ...
|
#
66e4f83c |
| 10-May-2013 |
Daniel Jasper <djasper@google.com> |
When breaking at function calls, indent from function name.
Otherwise (when indenting from the wrapped -> or .), this looks like a confusing indent.
Before: aaaaaaa // .aaaaaaa( //
When breaking at function calls, indent from function name.
Otherwise (when indenting from the wrapped -> or .), this looks like a confusing indent.
Before: aaaaaaa // .aaaaaaa( // aaaaaaa); After: aaaaaaa // .aaaaaaa( // aaaaaaa);
llvm-svn: 181595
show more ...
|
#
1cb530f1 |
| 10-May-2013 |
Daniel Jasper <djasper@google.com> |
Always format entire macro definitions.
Thereby, the macro is consistently formatted (including the trailing escaped newlines) even if clang-format is invoked only on single lines of the macro.
llv
Always format entire macro definitions.
Thereby, the macro is consistently formatted (including the trailing escaped newlines) even if clang-format is invoked only on single lines of the macro.
llvm-svn: 181590
show more ...
|
#
49149677 |
| 10-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Config file support for clang-format, part 2.
Summary: Adds actual config file reading to the clang-format utility. Configuration file name is .clang-format. It is looked up for each input file in i
Config file support for clang-format, part 2.
Summary: Adds actual config file reading to the clang-format utility. Configuration file name is .clang-format. It is looked up for each input file in its parent directories starting from immediate one. First found .clang-format file is used. When using standard input, .clang-format is searched starting from the current directory. Added -dump-config option to easily create configuration files.
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, jordan_rose, kimgr
Differential Revision: http://llvm-reviews.chandlerc.com/D758
llvm-svn: 181589
show more ...
|
#
8f9624b3 |
| 10-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug when formatting overloaded operators.
Before, the actual operator of an overloaded operator declaration was handled as a binary operator an thus, clang-format could not find valid formatting
Fix bug when formatting overloaded operators.
Before, the actual operator of an overloaded operator declaration was handled as a binary operator an thus, clang-format could not find valid formattings for many examples, e.g.:
template <typename AAAAAAA, typename BBBBBBB> AAAAAAA operator/(const AAAAAAA &a, BBBBBBB &b);
llvm-svn: 181585
show more ...
|
#
2f34cacc |
| 08-May-2013 |
Daniel Jasper <djasper@google.com> |
Further fix to pointer to member formatting.
With style where the *s go with the type: Before: typedef bool* (Class:: *Member)() const; After: typedef bool* (Class::*Member)() const;
llvm-svn: 181
Further fix to pointer to member formatting.
With style where the *s go with the type: Before: typedef bool* (Class:: *Member)() const; After: typedef bool* (Class::*Member)() const;
llvm-svn: 181439
show more ...
|
#
cfda517e |
| 08-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of pointers to members.
Before: int(S::*func)(void *); After: int (S::*func)(void *); llvm-svn: 181438
|
#
d69fc77b |
| 08-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve line breaking in binary expressions.
If the LHS of a binary expression is broken, clang-format should also break after the operator as otherwise: - The RHS can be easy to miss - It can look
Improve line breaking in binary expressions.
If the LHS of a binary expression is broken, clang-format should also break after the operator as otherwise: - The RHS can be easy to miss - It can look as if clang-format doesn't understand operator precedence
Before: bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd; After: bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd;
As an additional note, clang-format would also be ok with the following formatting, it just has a higher penalty (IMO correctly so). bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd;
llvm-svn: 181430
show more ...
|
#
0f0234e1 |
| 08-May-2013 |
Daniel Jasper <djasper@google.com> |
Change indentation of multi-line nested name specifiers.
Before: aaaaaaaa:: aaaaaaaa:: aaaaaaaa(); After: aaaaaaaa:: aaaaaaaa:: aaaaaaaa();
The reason for the change is that: a)
Change indentation of multi-line nested name specifiers.
Before: aaaaaaaa:: aaaaaaaa:: aaaaaaaa(); After: aaaaaaaa:: aaaaaaaa:: aaaaaaaa();
The reason for the change is that: a) we are not sure which is better b) it is a really rare edge case c) it simplifies the code d) it currently causes problems with memoization
llvm-svn: 181421
show more ...
|
Revision tags: llvmorg-3.3.0-rc1 |
|
#
d6538338 |
| 07-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Config file support for clang-format, part 1.
Summary: Added parseConfiguration method, which reads FormatStyle from YAML string. This supports all FormatStyle fields and an additional BasedOnStyle
Config file support for clang-format, part 1.
Summary: Added parseConfiguration method, which reads FormatStyle from YAML string. This supports all FormatStyle fields and an additional BasedOnStyle field, which can be used to specify base style.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D754
llvm-svn: 181326
show more ...
|
#
990ff972 |
| 07-May-2013 |
Daniel Jasper <djasper@google.com> |
Correctly recognize dereference after 'delete'.
With certain styles: Before: delete* x; After: delete *x;
llvm-svn: 181318
|
#
4a4be018 |
| 06-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't break comments after includes.
LLVM/Clang basically don't use such comments and for Google-style, include-lines are explicitly exempt from the column limit. Also, for most cases, where the col
Don't break comments after includes.
LLVM/Clang basically don't use such comments and for Google-style, include-lines are explicitly exempt from the column limit. Also, for most cases, where the column limit is violated, the "better" solution would be to move the comment to before the include, which clang-format cannot do (yet).
llvm-svn: 181191
show more ...
|
#
8e35769b |
| 06-May-2013 |
Daniel Jasper <djasper@google.com> |
Change indentation when breaking after a type.
clang-format did not indent any declarations/definitions when breaking after the type. With this change, it indents for all declarations but does not i
Change indentation when breaking after a type.
clang-format did not indent any declarations/definitions when breaking after the type. With this change, it indents for all declarations but does not indent for function definitions, i.e.:
Before: const SomeLongTypeName& some_long_variable_name; typedef SomeLongTypeName SomeLongTypeAlias; const SomeLongReturnType* SomeLongFunctionName(); const SomeLongReturnType* SomeLongFunctionName() { ... }
After: const SomeLongTypeName& some_long_variable_name; typedef SomeLongTypeName SomeLongTypeAlias; const SomeLongReturnType* SomeLongFunctionName(); const SomeLongReturnType* SomeLongFunctionName() { ... }
While it might seem inconsistent to indent function declarations, but not definitions, there are two reasons for that: - Function declarations are very similar to declarations of function type variables, so there is another side to consistency to consider. - There can be many function declarations on subsequent lines and not indenting can make them harder to identify. Function definitions are already separated by their body and not indenting makes the function name slighly easier to find.
llvm-svn: 181187
show more ...
|
#
a61aefb3 |
| 06-May-2013 |
Daniel Jasper <djasper@google.com> |
Break the class-inheritance ":" to the new line.
This seems to be more common in LLVM, Google and Chromium.
Before: class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBB
Break the class-inheritance ":" to the new line.
This seems to be more common in LLVM, Google and Chromium.
Before: class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC { };
After: class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC { };
llvm-svn: 181183
show more ...
|
#
10cd581f |
| 06-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't put a space before ellipsis.
Before: template <class ... Ts> void Foo(Ts ... ts) { Foo(ts ...); } After: template <class... Ts> void Foo(Ts... ts) { Foo(ts...); } llvm-svn: 181182
|
#
72463d32 |
| 03-May-2013 |
Daniel Jasper <djasper@google.com> |
Add space between ; and (.
Before: for (int i = 0;(i < 10); ++i) {} After: for (int i = 0; (i < 10); ++i) {} llvm-svn: 181020
|
#
c37de302 |
| 03-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix expression recognition in for-loops.
Before: for (; a&& b;) {} After: for (; a && b;) {} llvm-svn: 181017
|
#
e3c0e014 |
| 25-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's memoization behavior.
Deeply nested expressions basically break clang-format's memoization. This patch slightly improves the situations and makes expressions like
aaaaa(aaa
Improve clang-format's memoization behavior.
Deeply nested expressions basically break clang-format's memoization. This patch slightly improves the situations and makes expressions like
aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa())))))))))))))))))))))))))))))))))))))));
work.
llvm-svn: 180264
show more ...
|
#
6fe2f009 |
| 25-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Add option to align escaped newlines left.
This enables formattings like:
#define A \ int aaaa; \ int b; \ int ccc; \ int dddddddddd;
Enabling this for Google/Chromium styl
Add option to align escaped newlines left.
This enables formattings like:
#define A \ int aaaa; \ int b; \ int ccc; \ int dddddddddd;
Enabling this for Google/Chromium styles only as I don't know whether it is desired for Clang/LLVM.
llvm-svn: 180253
show more ...
|
#
770eb7c5 |
| 24-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix comment alignment behavior.
In the following snippet, clang-format incorrectly aligned the trailing comment, when only the last line was formatted:
int aaaaaa; // comment int b; int c; //
Fix comment alignment behavior.
In the following snippet, clang-format incorrectly aligned the trailing comment, when only the last line was formatted:
int aaaaaa; // comment int b; int c; // Formatting only this line moved this comment.
llvm-svn: 180173
show more ...
|
#
4431aa99 |
| 23-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of complex #if expressions.
Before: #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || \ defined DDDDDDDD) && define
Fix formatting of complex #if expressions.
Before: #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || \ defined DDDDDDDD) && defined(BBBBBBBB)
After: #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || defined DDDDDDDD) && \ defined(BBBBBBBB)
This fixes llvm.org/PR15828.
llvm-svn: 180105
show more ...
|
#
cc960fa6 |
| 22-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix bin-packing behavior of constructor initialziers.
In Google style, constructor initializers need to be all on one line or one initializer per line if that does not fit. Without this patch, this
Fix bin-packing behavior of constructor initialziers.
In Google style, constructor initializers need to be all on one line or one initializer per line if that does not fit. Without this patch, this non-bin-packing-behavior incorrectly extends to the parameters of the initializers.
Before: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {}
After: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {}
llvm-svn: 180001
show more ...
|
#
9e90b62e |
| 17-Apr-2013 |
Alexander Kornienko <alexfh@google.com> |
Unified token breaking logic: support for line comments.
Summary: Added BreakableLineComment, moved common code from BreakableBlockComment to newly added BreakableComment. As a side-effect of the re
Unified token breaking logic: support for line comments.
Summary: Added BreakableLineComment, moved common code from BreakableBlockComment to newly added BreakableComment. As a side-effect of the rewrite, found another problem with escaped newlines and had to change code which removes trailing whitespace from line comments not to break after this patch.
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D682
llvm-svn: 179693
show more ...
|
#
1b8e76f1 |
| 15-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Break after multiline parameters.
We do this in general, but missed a few cases.
Before: void aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa
Break after multiline parameters.
We do this in general, but missed a few cases.
Before: void aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb);
After: void aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb);
llvm-svn: 179570
show more ...
|