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

Remove the trailing whitespace of formatted lines.

So far, clang-format has always assumed the whitespace belonging to the
subsequent token. This has the negative side-effect that when
clang-format

Remove the trailing whitespace of formatted lines.

So far, clang-format has always assumed the whitespace belonging to the
subsequent token. This has the negative side-effect that when
clang-format formats a line, it does not remove its trailing whitespace,
as it belongs to the next token.

Thus, this patch fixes most of llvm.org/PR15062.

We are not zapping a file's trailing whitespace so far, as this does not
belong to any token we see during formatting. We need to fix this in a
subsequent patch.

llvm-svn: 175152

show more ...


# 66e9dee7 14-Feb-2013 Daniel Jasper <djasper@google.com>

Get less confused by trailing comma in Google style.

The formatter can now format:
void aaaaaaaaaaaaaaaaaa(int level,
double *min_x,
double *max_x,

Get less confused by trailing comma in Google style.

The formatter can now format:
void aaaaaaaaaaaaaaaaaa(int level,
double *min_x,
double *max_x,
double *min_y,
double *max_y,
double *min_z,
double *max_z, ) {
}

Although this is invalid code, it frequently happens during development and
clang-format should be nicer :-).

llvm-svn: 175151

show more ...


# b315ede9 14-Feb-2013 Daniel Jasper <djasper@google.com>

Remove accidentally committed empty test.

llvm-svn: 175148


# eead02b1 14-Feb-2013 Daniel Jasper <djasper@google.com>

Align superclasses for multiple inheritence.

This fixes llvm.org/PR15179.

Before:
class ColorChooserMac : public content::ColorChooser,
public content::WebContentsObserver {
};

After:
class Co

Align superclasses for multiple inheritence.

This fixes llvm.org/PR15179.

Before:
class ColorChooserMac : public content::ColorChooser,
public content::WebContentsObserver {
};

After:
class ColorChooserMac : public content::ColorChooser,
public content::WebContentsObserver {
};

llvm-svn: 175147

show more ...


# b9caeacd 13-Feb-2013 Daniel Jasper <djasper@google.com>

Allow breaking after the return type in function declarations.

This has so far been disabled for Google style, but should be done
before breaking at nested name specifiers or in template parameters.

Allow breaking after the return type in function declarations.

This has so far been disabled for Google style, but should be done
before breaking at nested name specifiers or in template parameters.

Before (in Google style):
template <typename T>
aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaa<
T>::aaaaaaa() {}

After:
template <typename T>
aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa>
aaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaa() {}

llvm-svn: 175074

show more ...


# 525264c3 13-Feb-2013 Daniel Jasper <djasper@google.com>

Fix comment alignment close to the column limit.

Due to an error in one of the expressions, we used to not align comments
although it would have been possible.

llvm-svn: 175068


# 71800c46 13-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: And more cast tests (these don't pass yet).

llvm-svn: 175031


# 4401b2a4 13-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add more cast tests.

llvm-svn: 175030


# c6fe2165 13-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Refactor the cast detection code to be a bit more readable.

No functionality change. Also add another cast test.

llvm-svn: 175029


# a789239c 13-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Detect ObjC method expressions after casts.

Not all casts are correctly detected yet, but it helps in some cases.

llvm-svn: 175028


# f52ab8d6 12-Feb-2013 Daniel Jasper <djasper@google.com>

Fix crash for incomplete labels in macros.

Still the formatting can be improved, but at least we don't assert any
more. This happened when trying to format lib/Sema/SemaType.cpp.

llvm-svn: 175003


# 2204562a 12-Feb-2013 Daniel Jasper <djasper@google.com>

Fix bug in the adjustment to existing lines.

Before (if only the second line was reformatted):
void f() {}
void g() {}

After:
void f() {}
void g() {}

llvm-svn: 174978


# 4444917f 12-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Correctly format stars in `sizeof(int**)` and similar places.

This redoes how '*' and '&' are classified as pointer / reference markers when
followed by ')', '>', or ','.

Previously, det

Formatter: Correctly format stars in `sizeof(int**)` and similar places.

This redoes how '*' and '&' are classified as pointer / reference markers when
followed by ')', '>', or ','.

Previously, determineStarAmpUsage() marked a single '*' and '&' followed by
')', '>', or ',' as pointer or reference marker. Now, all '*'s and '&'s
preceding ')', '>', or ',' are marked as pointer / reference markers. Fixes
PR14884.

Since only the last '*' in 'int ***' was marked as pointer before (the rest
were unary operators, which don't reach spaceRequiredBetween()),
spaceRequiredBetween() now had to be thought about handing multiple '*'s in
sequence.

Before:
return sizeof(int * *);
Type **A = static_cast<Type * *>(P);

Now:
return sizeof(int**);
Type **A = static_cast<Type **>(P);

While here, also make all methods of AnnotatingParser except parseLine()
private.

Review URL: http://llvm-reviews.chandlerc.com/D384

llvm-svn: 174975

show more ...


# 29f9dea1 11-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Detect ObjC message expressions after 'in' in loop

Before:
for (id foo in[self getStuffFor : bla]) {
}

Now:
for (id foo in [self getStuffFor:bla]) {
}

"in" is treated as loop ke

Formatter: Detect ObjC message expressions after 'in' in loop

Before:
for (id foo in[self getStuffFor : bla]) {
}

Now:
for (id foo in [self getStuffFor:bla]) {
}

"in" is treated as loop keyword if the line starts with "for", and as a
regular identifier else. To check for "in", its IdentifierInfo is handed
through a few layers.

llvm-svn: 174889

show more ...


# 2549956e 11-Feb-2013 Manuel Klimek <klimek@google.com>

Get rid of manual debug output, now that the test runner supports it.

You can run tests with -debug instead now.

llvm-svn: 174880


# eef30490 11-Feb-2013 Daniel Jasper <djasper@google.com>

Fix invalid formatting with spaces before trailing comments.

In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format f

Fix invalid formatting with spaces before trailing comments.

In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format from
creating a line with 81 columns.

llvm-svn: 174879

show more ...


# 0c13795f 11-Feb-2013 Manuel Klimek <klimek@google.com>

Fixes handling of empty lines in macros.

Now correctly formats:
#define A \
\
b;
to
#define A b;

Added the state whether an unwrapped line is a macro to the debug
output.

llvm-svn: 174878


# 35d2dc76 11-Feb-2013 Daniel Jasper <djasper@google.com>

Fix formatting of overloaded operator definitions.

Before:
operatorvoid*();
operator vector< A< A>>();

After:
operator void *();
operator vector<A<A> >();

llvm-svn: 174863


# 0448b4dd 10-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add a test for multi-line ObjC dict literals.

As it turns out, this already works reasonably well.

This example from http://clang.llvm.org/docs/ObjectiveCLiterals.html
NSDictionary *dict

Formatter: Add a test for multi-line ObjC dict literals.

As it turns out, this already works reasonably well.

This example from http://clang.llvm.org/docs/ObjectiveCLiterals.html
NSDictionary *dictionary = @{
@"name" : NSUserName(),
@"date" : [NSDate date],
@"processInfo" : [NSProcessInfo processInfo]
};

is formatted like
NSDictionary *dictionary = @{ @"name" : NSUserName(), @"date" : [NSDate date],
@"processInfo" : [NSProcessInfo processInfo] };

There's already a FIXME in NestedStaticInitializers about supporting one
initializer per line, which is really all that's missing here too.

llvm-svn: 174842

show more ...


# 33c68e90 10-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add another ObjC literal test.

(From http://clang.llvm.org/docs/ObjectiveCLiterals.html.)

llvm-svn: 174841


# 372d8dcf 10-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Initial support for ObjC dictionary literals.

Before:
@{
foo:
bar
}
;

Now:
@{ foo : bar };

parseBracedList() already does the right thing from an UnwrappedLineParser
persp

Formatter: Initial support for ObjC dictionary literals.

Before:
@{
foo:
bar
}
;

Now:
@{ foo : bar };

parseBracedList() already does the right thing from an UnwrappedLineParser
perspective, so check for "@{" in all loops that process constructs that can
contain expressions and call parseBracedList() if found.

llvm-svn: 174840

show more ...


# 2a726b6c 10-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Detect ObjC array literals.

Use this to add a space after "@[" and before "]" for now.

Later, I want to use this to format multi-line array literals nicer, too.

llvm-svn: 174822


# 06fcec1c 09-Feb-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add test for default arguments.

llvm-svn: 174816


# d076dcd5 08-Feb-2013 Manuel Klimek <klimek@google.com>

Fix indentation-detection at indent level 0.

This correctly formats:
{
a;
}
where { is incorrectly indented by 2, but is at level 0, when
reformatting only 'a;'.

llvm-svn: 174737


# b95f5450 08-Feb-2013 Manuel Klimek <klimek@google.com>

Takes the context into account when re-indenting regions.

Fixes llvm.org/PR14916.

llvm-svn: 174720


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