History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1826 – 1850 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# f7f13c0e 04-Feb-2013 Daniel Jasper <djasper@google.com>

Fix an error in formatting of for-loops.

Two minor changes:
* Slight penalty for breaking at "," as opposed to ";".
* Don't apply bin-packing rules to for-loops.

Before:
for (int aaaaaa = aaaaaaaaa

Fix an error in formatting of for-loops.

Two minor changes:
* Slight penalty for breaking at "," as opposed to ";".
* Don't apply bin-packing rules to for-loops.

Before:
for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa,
++ccccccccccccccc) {}

After:
for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb;
++aaaaaa, ++ccccccccccccccc) {}

llvm-svn: 174308

show more ...


# 3a9370cb 04-Feb-2013 Daniel Jasper <djasper@google.com>

Restructuring of token annotation for formatting.

This combines several changes:
* Calculation token type (e.g. for * and &) in the AnnotatingParser.
* Calculate the scope binding strength in the An

Restructuring of token annotation for formatting.

This combines several changes:
* Calculation token type (e.g. for * and &) in the AnnotatingParser.
* Calculate the scope binding strength in the AnnotatingParser.
* Let <> and [] scopes bind stronger than () and {} scopes.
* Add minimal debugging output.

llvm-svn: 174307

show more ...


# 1ca05ccf 03-Feb-2013 Daniel Jasper <djasper@google.com>

Fix bug in formatting of nested initializers.

We can now format:
SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } },
{ { 111111111111111111111111111111,

Fix bug in formatting of nested initializers.

We can now format:
SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } },
{ { 111111111111111111111111111111,
222222222222222222222222222222,
333333333333333333333333333333 } },
{ { 1, 2, 3 } }, { { 1, 2, 3 } } };

Before, we did strange things there.

llvm-svn: 174291

show more ...


# 591b5802 31-Jan-2013 Manuel Klimek <klimek@google.com>

Never break inside something that was a preprocessor directive.

Just put it in one unwrapped line and let the formatter handle it.

llvm-svn: 174063


# 8a8ce240 31-Jan-2013 Daniel Jasper <djasper@google.com>

Several improvements to the formatting of static initializers.

1. Never avoid bin packing in static initializers as this can
lead to terrible results.
2. If an element has to be broken over multi

Several improvements to the formatting of static initializers.

1. Never avoid bin packing in static initializers as this can
lead to terrible results.
2. If an element has to be broken over multiple lines, break after
the following comma.

This should be a step forward, but there are still many cases
especially with nested static initializers that we handle badly.
More patches will follow.

llvm-svn: 174061

show more ...


# 7b038a23 30-Jan-2013 Daniel Jasper <djasper@google.com>

Don't generate no-op replacements.

No functional changes.

llvm-svn: 173916


# ddaa9be9 29-Jan-2013 Daniel Jasper <djasper@google.com>

Improve formatting of code with comments.

Before:
aaaaaaa(aaaaaa( // comment
aaaaaaa));
<big mess>

After:
aaaaaaa(aaaaaa( // comment
aaaaaaaa));
function(/* parameter 1 */ aaaaa

Improve formatting of code with comments.

Before:
aaaaaaa(aaaaaa( // comment
aaaaaaa));
<big mess>

After:
aaaaaaa(aaaaaa( // comment
aaaaaaaa));
function(/* parameter 1 */ aaaaaaa,
/* parameter 2 */ aaaaaaa,
/* parameter 3 */ aaaaaaa,
/* parameter 4 */ aaaaaaa);

(the latter example was only wrong in the one-arg-per-line mode, e.g. in
Google style).

llvm-svn: 173821

show more ...


# f7db433e 29-Jan-2013 Daniel Jasper <djasper@google.com>

Allow all parameters on next line for function calls in Chrome.

The style guide only forbids this for function declarations. So,
now

someFunction(
aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaa

Allow all parameters on next line for function calls in Chrome.

The style guide only forbids this for function declarations. So,
now

someFunction(
aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaa);

Is allowed in Chromium mode.

llvm-svn: 173806

show more ...


# 38c11ce9 29-Jan-2013 Daniel Jasper <djasper@google.com>

Initial support for multiple variable declarations.

Before:
SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();
After:
SomeType aaaaaaaaaaaaaaaaa

Initial support for multiple variable declarations.

Before:
SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();
After:
SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();

llvm-svn: 173792

show more ...


# 6a217e18 29-Jan-2013 Daniel Jasper <djasper@google.com>

Reverting changes from r173785 (removing empty lines before "}").

This needs some more thinking, e.g. for namespaces, chains of if-else
if, ...

llvm-svn: 173787


# aa94a90a 29-Jan-2013 Daniel Jasper <djasper@google.com>

Remove empty lines before "}".

Those empty lines waste vertical whitespace and almost never
increase readability.

Before:
void f() {
DoSomething();

}

After:
void f() {
DoSomething();
}

llvm-

Remove empty lines before "}".

Those empty lines waste vertical whitespace and almost never
increase readability.

Before:
void f() {
DoSomething();

}

After:
void f() {
DoSomething();
}

llvm-svn: 173785

show more ...


# 48c62f98 28-Jan-2013 Daniel Jasper <djasper@google.com>

Fix a bug that would lead to bad line break decisions in for loops.

Before:
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa
.aaaaaaaaaaaaaaaa;
aaaaaa

Fix a bug that would lead to bad line break decisions in for loops.

Before:
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa
.aaaaaaaaaaaaaaaa;
aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}

After:
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa =
aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa;
aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}

llvm-svn: 173695

show more ...


# d36ef5e4 28-Jan-2013 Daniel Jasper <djasper@google.com>

Don't put a function's return type on its own line in Google style.

This would be against the style guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declaration

Don't put a function's return type on its own line in Google style.

This would be against the style guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declarations_and_Definitions#Function_Declarations_and_Definitions

Not sure what to do as a last resort if the function signature does not
fit onto a single line in Google style ..

llvm-svn: 173690

show more ...


# d2639ef5 28-Jan-2013 Daniel Jasper <djasper@google.com>

Let clang-format break after a function's return type.

Before:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo

Let clang-format break after a function's return type.

Before:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *II,
Type *T) {}

After:
TypeSpecDecl *
TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *II, Type *T) {}

This fixes llvm.org/PR14717.

llvm-svn: 173688

show more ...


# 65585ed8 28-Jan-2013 Daniel Jasper <djasper@google.com>

Make continuations in constructor initializers consistent.

Before:
Constructor
: LooooooooooooooooooooongVariable(
LooooooooooooooooooooongValue) {}

After:
Constructor
: Loooooooooo

Make continuations in constructor initializers consistent.

Before:
Constructor
: LooooooooooooooooooooongVariable(
LooooooooooooooooooooongValue) {}

After:
Constructor
: LooooooooooooooooooooongVariable(
LooooooooooooooooooooongValue) {}

llvm-svn: 173685

show more ...


# 0b41cbb5 28-Jan-2013 Daniel Jasper <djasper@google.com>

Initial support for formatting range-based for-loops.

Before (in good cases):
for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
for (auto aaaa

Initial support for formatting range-based for-loops.

Before (in good cases):
for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa,
aaaa)) {}

After:
for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa :
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
for (auto aaaaaaaaaaaaaaaaaaaa :
aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {}

llvm-svn: 173684

show more ...


# ca6623b9 28-Jan-2013 Daniel Jasper <djasper@google.com>

Improve formatting of conditional expressions.

Before we did not really systematically format those. Now, we format the
different cases as:

- 1 Line: a ? b : c;
- 2 Lines: short ? loooooooooong

Improve formatting of conditional expressions.

Before we did not really systematically format those. Now, we format the
different cases as:

- 1 Line: a ? b : c;
- 2 Lines: short ? loooooooooong
: loooooooooong
- 2 Lines: loooooooooooooooong
? short : short
- 3 Lines: loooooooooooooooong
? loooooooooooooong
: loooooooooooooong

Not sure whether "?" and ":" should go on the new line, but it seems to
be the most consistent approach.

llvm-svn: 173683

show more ...


# 20b09efa 28-Jan-2013 Daniel Jasper <djasper@google.com>

Several small changes in formatting decisions.

1. Use a hanging ident for function calls nested in binary expressions.
E.g.:
int aaaaa = aaaaaaaaa && aaaaaaaaaa(

Several small changes in formatting decisions.

1. Use a hanging ident for function calls nested in binary expressions.
E.g.:
int aaaaa = aaaaaaaaa && aaaaaaaaaa(
aaaaaaaaaa);

2. Slightly improve heuristic for builder type expressions and reduce
penalty for breaking before "." and "->" in those.

3. Remove mostly obsolete metric of decreasing indent level. This
fixes: llvm.org/PR14931.

Changes #1 and #2 were necessary to keep tests passing after #3.

llvm-svn: 173680

show more ...


# 4ad42359 28-Jan-2013 Daniel Jasper <djasper@google.com>

Improve indentation after breaking at nested name specifiers.

These always represent a continuation and we should increase the ident.

Before:
aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa::
aaaaaaaaaaa

Improve indentation after breaking at nested name specifiers.

These always represent a continuation and we should increase the ident.

Before:
aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa::
aaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa::
aaaaaaaaaaaaaaaaaaaa);

llvm-svn: 173675

show more ...


# 7b5773e9 28-Jan-2013 Daniel Jasper <djasper@google.com>

Avoid confusing identations for multi-parameter functions.

Before:
aaaaaaaa(aaaaaaaaa(
aaaaaaaaaa(),
aaaaaaaaa);

After:
aaaaaaaa(aaaaaaaaa(
aaaaaaaaaa(),
aaaaaaaa

Avoid confusing identations for multi-parameter functions.

Before:
aaaaaaaa(aaaaaaaaa(
aaaaaaaaaa(),
aaaaaaaaa);

After:
aaaaaaaa(aaaaaaaaa(
aaaaaaaaaa(),
aaaaaaaaa);

llvm-svn: 173673

show more ...


# 7a31af14 25-Jan-2013 Daniel Jasper <djasper@google.com>

Fix some alignment and line break decisions.

This combines two small changes:
1) Put a penalty on breaking after "<"
2) Only produce a hanging indent when parameters are separated by
commas.

Before

Fix some alignment and line break decisions.

This combines two small changes:
1) Put a penalty on breaking after "<"
2) Only produce a hanging indent when parameters are separated by
commas.

Before:
aaaaaaaaaaaaaaaaaaaaaaaa<
aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));

After:
aaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));

This changes one ObjC test, but AFAICT this is not according to any
style guide (neither before nor after). We probably should be aligning
on the ":" there according to:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=Method_Invocations#Method_Invocations

llvm-svn: 173457

show more ...


# 45797021 25-Jan-2013 Daniel Jasper <djasper@google.com>

Allow breaking after "::" if absolutely necessary.

Otherwise, really long nested name specifiers can easily lead to a
violation of the column limit.

Not sure about the rules for indentation in thos

Allow breaking after "::" if absolutely necessary.

Otherwise, really long nested name specifiers can easily lead to a
violation of the column limit.

Not sure about the rules for indentation in those cases, so input is
appreciated (see tests.).

llvm-svn: 173438

show more ...


# 39e2738c 23-Jan-2013 Daniel Jasper <djasper@google.com>

Add extra indent for nested calls inside if's.

Before:
if (aaaaaaaaaa(
aaaaaaaaaa)) {}

After:
if (aaaaaaaaaa(
aaaaaaaaaa)) {}

llvm-svn: 173290


# a836b90a 23-Jan-2013 Daniel Jasper <djasper@google.com>

Don't try to align builder-type continuations on assignments.

Before:
int aaaa = aaaaa().aaaaa() // force break
.aaaaa();
After:
int aaaa = aaaaa().aaaaa() // force break
.aaaaa();

T

Don't try to align builder-type continuations on assignments.

Before:
int aaaa = aaaaa().aaaaa() // force break
.aaaaa();
After:
int aaaa = aaaaa().aaaaa() // force break
.aaaaa();

The other indent is just wrong and confusing.

llvm-svn: 173273

show more ...


# 1565eb3e 23-Jan-2013 Daniel Jasper <djasper@google.com>

Don't try to do a hanging ident after assignments.

Before:
bool aaaa = aaaaaaaaaaa(
aaaaaaaaaaaaaaaaa);

After:
bool aaaa = aaaaaaaaaaa(
aaaaaaaaaaaaaaaaa);

The other indentatio

Don't try to do a hanging ident after assignments.

Before:
bool aaaa = aaaaaaaaaaa(
aaaaaaaaaaaaaaaaa);

After:
bool aaaa = aaaaaaaaaaa(
aaaaaaaaaaaaaaaaa);

The other indentation was a nice attempt but doesn't work in many cases.
Not sure what the right long term solution is as the "After: " is still
not nice. We either need to figure out what to do in the cases where it
"doesn't work" or come up with a third solution, e.g. falling back to:

bool aaaa =
aaaaaaaaaaa(
aaaaaaaaaaaaaaaaa);

which should always work and nicely highlight the structure.

llvm-svn: 173268

show more ...


1...<<71727374757677787980>>...82