History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 2001 – 2025 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d1926a37 02-Jan-2013 Daniel Jasper <djasper@google.com>

Don't break after pointer or reference specifier.

This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,

Don't break after pointer or reference specifier.

This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *II, Type *T) {

Now changed to:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *II,
Type *T) {

llvm-svn: 171357

show more ...


# 58d64e2b 30-Dec-2012 Dmitri Gribenko <gribozavr@gmail.com>

Formatter: parse and format inline namespaces like regular namespaces

This changes formatting from:

inline namespace X {
class A {
};
}

to:

inline namespace X {
class A {
};
}

llvm-svn: 1712

Formatter: parse and format inline namespaces like regular namespaces

This changes formatting from:

inline namespace X {
class A {
};
}

to:

inline namespace X {
class A {
};
}

llvm-svn: 171266

show more ...


# 6d822720 24-Dec-2012 Daniel Jasper <djasper@google.com>

Penalize tokens with a lower parenthesis level than the start of the line.

This prevents formattings like this (assuming "parameter" doesn't fit the line):
bool f = someFunction() && someFunctionW

Penalize tokens with a lower parenthesis level than the start of the line.

This prevents formattings like this (assuming "parameter" doesn't fit the line):
bool f = someFunction() && someFunctionWithParam(
parameter) && someOtherFunction();

Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but
there are subsequent tokens ("&&" and "someOtherFunction") with a lower level.
This is bad for readability as "parameter" hides "someOtherFunction". With this
patch, this changes to:
bool f = someFunction() &&
someFunctionWithParam(parameter) &&
someOtherFunction();

llvm-svn: 171038

show more ...


# 2eda23e7 24-Dec-2012 Daniel Jasper <djasper@google.com>

Align RHS after assignments and return statements.

This changes:
int Result = a + // force break
b;
return Result + // force break
5;

To:
int Result = a + // force break

Align RHS after assignments and return statements.

This changes:
int Result = a + // force break
b;
return Result + // force break
5;

To:
int Result = a + // force break
b;
return Result + // force break
5;

llvm-svn: 171032

show more ...


# 537a2963 24-Dec-2012 Daniel Jasper <djasper@google.com>

Fix formatting over overloaded operators.

This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch cha

Fix formatting over overloaded operators.

This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch changes, e.g.

operator *() {}
operator >() {}
operator () () {}

to

operator*() {}
operator>() {}
operator()() {}

llvm-svn: 171028

show more ...


# de5c2079 24-Dec-2012 Daniel Jasper <djasper@google.com>

Take operator precedence into account when splitting lines.

With this patch, splitting after binary operators has a panelty corresponding
to the operator's precedence. We used to ignore this and eag

Take operator precedence into account when splitting lines.

With this patch, splitting after binary operators has a panelty corresponding
to the operator's precedence. We used to ignore this and eagerly format like:

if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb &&
ccccccccccccccccccccccccc) { .. }

With this patch, this becomes:

if (aaaaaaaaaaaaaaaaaaaaaaaaa ||
bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. }

llvm-svn: 171007

show more ...


# 6f372e65 23-Dec-2012 Nico Weber <nicolasweber@gmx.de>

libFormat: Teach the *& usage heuristic that "return" starts a rhs too.

"return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;".

Fixes PR14687 partially.

llvm-svn: 17

libFormat: Teach the *& usage heuristic that "return" starts a rhs too.

"return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;".

Fixes PR14687 partially.

llvm-svn: 170993

show more ...


# 9017ec3a 21-Dec-2012 Fariborz Jahanian <fjahanian@apple.com>

Adding to FormatTest.cpp test for a very long ObjC method
declaration requiring formatting of wrap-arounds.

llvm-svn: 170946


# 8f83ee46 21-Dec-2012 Nico Weber <nicolasweber@gmx.de>

format: Handle #import as include directive too.

llvm-svn: 170914


# 050948a5 21-Dec-2012 Daniel Jasper <djasper@google.com>

clang-format: No spaces around directory specifiers

This fixes PR14683. We used to format like this:
#include <a / b>

And this patch changes this to:
#include <a/b>

llvm-svn: 170910


# fbde69e2 21-Dec-2012 Daniel Jasper <djasper@google.com>

Basic support for formatting for-loops.

We used to not really format them. Now we do:

for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
SE = BB-

Basic support for formatting for-loops.

We used to not really format them. Now we do:

for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
SE = BB->succ_end();
SI != SE; ++SI) {

This is just one example and I am sure we still mess some of them up, but it
is a step forward.

llvm-svn: 170899

show more ...


# 8dd40473 21-Dec-2012 Daniel Jasper <djasper@google.com>

Formatting fixes for PR14680

Also, some (automated) formatting fixes and slight cleanups.

llvm-svn: 170873


Revision tags: llvmorg-3.2.0
# 68a542ae 20-Dec-2012 Fariborz Jahanian <fjahanian@apple.com>

Add objective-C style formatting to clang format and
use it to format xml declaration tags.
// rdar://12378714

llvm-svn: 170727


# 2af6bbe7 18-Dec-2012 Daniel Jasper <djasper@google.com>

Better support for constructor initializers.

We used to format initializers like this (with a sort of hacky implementation):
Constructor()
: Val1(A),
Val2(B) {

and now format like this (w

Better support for constructor initializers.

We used to format initializers like this (with a sort of hacky implementation):
Constructor()
: Val1(A),
Val2(B) {

and now format like this (with a somewhat better solution):
Constructor()
: Val1(A), Val2(B) {

assuming this would not fit on a single line. Also added tests.

As a side effect we now first analyze whether an UnwrappedLine needs to be
split at all. If not, not splitting it is the best solution by definition. As
this should be a very common case in normal code, not exploring the entire
solution space can provide significant speedup.

llvm-svn: 170457

show more ...


# 3f69a1b8 18-Dec-2012 Daniel Jasper <djasper@google.com>

Make the format scrambler understand line comments.

This allows for writing tests including line comments easier and more readable.
We will need more of those tests in the future and also line comme

Make the format scrambler understand line comments.

This allows for writing tests including line comments easier and more readable.
We will need more of those tests in the future and also line comments are
useful to force line breaks in tests.

llvm-svn: 170446

show more ...


# 5485d0cd 17-Dec-2012 Daniel Jasper <djasper@google.com>

Add basic support for splitting before function calls if it can't be
avoided.

This required a minor modification of the memoization as now the
"CurrentPenalty" depends on whether or not we break bef

Add basic support for splitting before function calls if it can't be
avoided.

This required a minor modification of the memoization as now the
"CurrentPenalty" depends on whether or not we break before the current
token. Therefore, the CurrentPenalty should not be memoized but added
after retrieving a value from memory. This should not affect the runtime
behavior.

llvm-svn: 170337

show more ...


# e25509f8 17-Dec-2012 Daniel Jasper <djasper@google.com>

Fix several formatting problems.

More specifically:
- Improve formatting of static initializers.
- Fix formatting of lines comments in enums.
- Fix formmating of trailing line comments.

llvm-svn: 1

Fix several formatting problems.

More specifically:
- Improve formatting of static initializers.
- Fix formatting of lines comments in enums.
- Fix formmating of trailing line comments.

llvm-svn: 170316

show more ...


# a4396865 10-Dec-2012 Daniel Jasper <djasper@google.com>

Addi formatting tests for pointer template parameters.

Fix spacing before ",".

llvm-svn: 169746


# 2ca766f3 10-Dec-2012 Alexander Kornienko <alexfh@google.com>

Clang-format: error recovery for access specifiers

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D198

llvm-svn: 169738


# 2723403f 07-Dec-2012 Daniel Jasper <djasper@google.com>

Small tweaks to clang-format.

Now not joining keywords with '::' and not putting a space between
a pointer pointer.

llvm-svn: 169594


# 578fdd89 06-Dec-2012 Alexander Kornienko <alexfh@google.com>

Clang-format: IndentCaseLabels option, proper namespace handling

Summary: + tests arranged in groups, as their number is already quite large.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: c

Clang-format: IndentCaseLabels option, proper namespace handling

Summary: + tests arranged in groups, as their number is already quite large.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D185

llvm-svn: 169520

show more ...


# ecdc7507 06-Dec-2012 Alexander Kornienko <alexfh@google.com>

Clang-format: detect unbalanced braces.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits, silvas

Differential Revision: http://llvm-reviews.chandlerc.com/D176

llvm-svn: 169518


# 26333c3b 06-Dec-2012 Daniel Jasper <djasper@google.com>

Improve clang-format's handling of unary operators.

llvm-svn: 169500


# e9de2604 06-Dec-2012 Daniel Jasper <djasper@google.com>

"<<" alignment for clang-format.

Also, small fix for handling the first token correctly.

Review: http://llvm-reviews.chandlerc.com/D177
llvm-svn: 169488


Revision tags: llvmorg-3.2.0-rc3
# 37d6c94e 05-Dec-2012 Alexander Kornienko <alexfh@google.com>

Clang-format: parse for and while loops

Summary: Adds support for formatting for and while loops.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llv

Clang-format: parse for and while loops

Summary: Adds support for formatting for and while loops.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D174

llvm-svn: 169387

show more ...


1...<<8182