#
7194e181 |
| 10-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's understanding of casts.
This fixes llvm.org/PR14684.
Before: int *pa = (int *) & a; After: int *pa = (int *)&a;
We still don't understand all kinds of casts. I added a FIXM
Improve clang-format's understanding of casts.
This fixes llvm.org/PR14684.
Before: int *pa = (int *) & a; After: int *pa = (int *)&a;
We still don't understand all kinds of casts. I added a FIXME to address that.
llvm-svn: 172056
show more ...
|
#
83a54d23 |
| 10-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Do more error checking for '{}'.
This fixes llvm.org/PR14883, where clang-format would run into an assertion on:
void f() { return } 42
llvm-svn: 172049
|
#
bbe28b3d |
| 10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove unused @-formatting code.
@optional @property is put on two different unwrapped lines now, so this is no longer necessary.
llvm-svn: 172024
|
#
51306d23 |
| 10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: @optional and @required go on their own line.
Previously: @protocol myProtocol - (void)mandatoryWithInt:(int)i; @optional - (void) optional; @required - (void) required; @end
Now: @proto
Formatter: @optional and @required go on their own line.
Previously: @protocol myProtocol - (void)mandatoryWithInt:(int)i; @optional - (void) optional; @required - (void) required; @end
Now: @protocol myProtocol - (void)mandatoryWithInt:(int)i; @optional - (void)optional; @required - (void)required; @end
llvm-svn: 172023
show more ...
|
#
52b15154 |
| 09-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Enables layouting unwrapped lines around preprocessor directives.
Previously, we'd always start at indent level 0 after a preprocessor directive, now we layout the following snippet (column limit 69
Enables layouting unwrapped lines around preprocessor directives.
Previously, we'd always start at indent level 0 after a preprocessor directive, now we layout the following snippet (column limit 69) as follows:
functionCallTo(someOtherFunction( withSomeParameters, whichInSequence, areLongerThanALine(andAnotherCall, B withMoreParamters, whichStronglyInfluenceTheLayout), andMoreParameters), trailing);
Note that the different jumping indent is a different issue that will be addressed separately.
This is the first step towards handling #ifdef->#else->#endif chains correctly.
llvm-svn: 171974
show more ...
|
#
bcab430f |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Only align after assignments on the top level.
This fixes llvm.org/PR14870 and we no longer mess up: template <typename T1, typename T2 = char, typename T3 = char, typename T4 = char> void
Only align after assignments on the top level.
This fixes llvm.org/PR14870 and we no longer mess up: template <typename T1, typename T2 = char, typename T3 = char, typename T4 = char> void f();
It removes the nice aligment for assignments inside other expressions, but I am not sure those are actually practically relevant. If so, we can fix those later.
llvm-svn: 171966
show more ...
|
#
2df93311 |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't simply give up when exceeding 80cols, choose an "ok" option.
This addresses llvm.org/PR14847.
We can now format something like: int aaaaaaaaaaaaaaaaaaaaaaaaaaa = // aaaaaaaaaaaaaaaaaaaaaa
Don't simply give up when exceeding 80cols, choose an "ok" option.
This addresses llvm.org/PR14847.
We can now format something like: int aaaaaaaaaaaaaaaaaaaaaaaaaaa = // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
clang-format unavoidably exceeds the column limit, but does not just flush everything into a single line. Moreover, it tries to minimize the number of characters beyond the column limit.
llvm-svn: 171964
show more ...
|
#
89058941 |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Correctly format wrapped function call parameters in templated functions.
This fixes llvm.org/PR14846.
Before: template <typename T> void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
Correctly format wrapped function call parameters in templated functions.
This fixes llvm.org/PR14846.
Before: template <typename T> void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa);
After: template <typename T> void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa);
llvm-svn: 171963
show more ...
|
#
d8bb2db2 |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow comments in the middle of statements to be on their own line.
This fixes llvm.org/PR14860.
Before, we messed up the format of: if (DeclaratorInfo.isFunctionDeclarator() && //getDeclSpecCo
Allow comments in the middle of statements to be on their own line.
This fixes llvm.org/PR14860.
Before, we messed up the format of: if (DeclaratorInfo.isFunctionDeclarator() && //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level && Tok.is(tok::semi) && NextToken().is(tok::l_brace)) { }
llvm-svn: 171961
show more ...
|
#
fb3f2482 |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix ObjC block declarations.
Before: int ( ^ Block1) (int, int) = ^ (int i, int j) After: int (^Block1) (int, int) = ^(int i, int j) llvm-svn: 171959
|
#
399d24bc |
| 09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of conditional operators.
This addresses llvm.org/PR14864.
We used to completely mess this up and now format as: Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag
Improve formatting of conditional operators.
This addresses llvm.org/PR14864.
We used to completely mess this up and now format as: Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName();
llvm-svn: 171957
show more ...
|
#
66dcb1ca |
| 08-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't break after unary operators.
Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, * aaaaaaaaaaaaaaaaaaaaaaaaa
Don't break after unary operators.
Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, * aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 171890
show more ...
|
#
77aa2509 |
| 08-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Format @ literals better. Array and dictionary literals need more work.
llvm-svn: 171887
|
#
4f397156 |
| 08-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't put spaces around ##.
In Clang/LLVM this seems to be the more common formatting for ##s. There might still be case that we miss, but we'll fix those as we go along.
Before:
#define A(X)
Don't put spaces around ##.
In Clang/LLVM this seems to be the more common formatting for ##s. There might still be case that we miss, but we'll fix those as we go along.
Before:
#define A(X) void function ## X();
After:
#define A(X) void function##X();
llvm-svn: 171862
show more ...
|
#
7c85fde5 |
| 08-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Change the data structure used in clang-format.
This is a first step towards supporting more complex structures such as #ifs inside unwrapped lines. This patch mostly converts the array-based Unwrap
Change the data structure used in clang-format.
This is a first step towards supporting more complex structures such as #ifs inside unwrapped lines. This patch mostly converts the array-based UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will allow multiple children for each Token turning the UnwrappedLine into a tree.
No functional changes intended.
llvm-svn: 171856
show more ...
|
#
04e9f1ab |
| 07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Support @public/@protected/@package/@private.
@package is an Objective-C 2 feature, so turn on ObjC2 as well.
llvm-svn: 171766
|
#
d5650bdc |
| 07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Add tests for try/catch. Let 'throw' start an expression.
Before: throw a *b;
Now: throw a * b;
llvm-svn: 171754
|
#
e89c42f4 |
| 07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Don't put spaces betwen @ and objc keywords.
llvm-svn: 171753
|
#
f8673bca |
| 07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Small refactoring of the formatter code.
This should make it slightly more readable as it more clearly separates what happens where. No intended functional changes. More of this to come..
llvm-svn:
Small refactoring of the formatter code.
This should make it slightly more readable as it more clearly separates what happens where. No intended functional changes. More of this to come..
llvm-svn: 171748
show more ...
|
#
49cbc2cb |
| 07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Fix typo.
llvm-svn: 171740
|
#
8d1832e0 |
| 07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Reformat clang-formats source code.
All changes done by clang-format itself. No functional changes.
llvm-svn: 171732
|
#
206df734 |
| 07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Prefer not to break after assignments.
This addresses llvm.org/PR14830.
Before: unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(), SI->get
Prefer not to break after assignments.
This addresses llvm.org/PR14830.
Before: unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(), SI->getPointerAddressSpace()); CharSourceRange LineRange = CharSourceRange::getTokenRange(TheLine.Tokens.front().Tok.getLocation(), TheLine.Tokens.back().Tok.getLocation());
After: unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(), SI->getPointerAddressSpace()); CharSourceRange LineRange = CharSourceRange::getTokenRange( TheLine.Tokens.front().Tok.getLocation(), TheLine.Tokens.back().Tok.getLocation());
This required rudimentary changes to static initializer lists, but we are not yet formatting them in a reasonable way. That will be done in a subsequent patch.
llvm-svn: 171731
show more ...
|
#
5ad1e199 |
| 07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add style option for number of spaces before trailing comments.
In LLVM style, a single space should be enough. In Google style, two spaces are required.
llvm-svn: 171725
|
#
da16db3f |
| 07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Do not break before "0" in pure virtual function declarations.
Before: virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) = 0
After: virtual void write(ELFWriter *writer
Do not break before "0" in pure virtual function declarations.
Before: virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) = 0
After: virtual void write(ELFWriter *writerrr, OwningPtr<FileOutputBuffer> &buffer) = 0;
This addresses llvm.org/PR14815.
To implement this I introduced a line type during parsing and moved the definition of TokenType out of the struct for increased readability. Should have done the latter in a separate patch, but it would be hard to pull apart now.
llvm-svn: 171724
show more ...
|
#
c6827ae7 |
| 07-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Remove outdated fixme.
llvm-svn: 171716
|