History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1926 – 1950 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# a21aaae7 11-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Format ObjC static and instance methods consistently, add a test for that.

llvm-svn: 172254


# 9fa8d557 11-Jan-2013 Manuel Klimek <klimek@google.com>

Fix crashes in UnwrappedLineParser on missing parens.

llvm-svn: 172239


# 2acb7b7b 11-Jan-2013 Manuel Klimek <klimek@google.com>

Fix single-line optimization for ObjC.

Puts blocks always into multiple lines when they start with an ObjC
keyword or minus.

llvm-svn: 172238


# adededff 11-Jan-2013 Manuel Klimek <klimek@google.com>

Fix crash on invalid.

if { foo; }
would previously crash clang-format.

llvm-svn: 172232


# d5e5f8f2 11-Jan-2013 Manuel Klimek <klimek@google.com>

Fix parsing of initializer lists with elaborated type specifier.

Now we correctly parse and format:
verifyFormat("struct foo a = { bar };
int n;

llvm-svn: 172229


# f4ab9ef3 11-Jan-2013 Manuel Klimek <klimek@google.com>

Implements pulling simple blocks into a single line.

void f() { return 42; }

The final change that implements the feature.

llvm-svn: 172225


# d6a947f7 11-Jan-2013 Daniel Jasper <djasper@google.com>

Correct spacing around new and delete.

This fixes llvm.org/PR14913.

Before: A *a = new(placement) A;
After: A *a = new (placement) A;
llvm-svn: 172212


# fd8c4b13 11-Jan-2013 Daniel Jasper <djasper@google.com>

Improve handling of trailing declaration annotations.

Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(
aaaaaaaaaaaaa);

After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaa

Improve handling of trailing declaration annotations.

Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(
aaaaaaaaaaaaa);

After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
GUARDED_BY(aaaaaaaaaaaaa);

Also did some formatting cleanups with clang-format on the way.

llvm-svn: 172200

show more ...


# 2408a8c7 11-Jan-2013 Daniel Jasper <djasper@google.com>

Improved formatting of constructor initializers

Added option to put each constructor initializer on its own line
if not all initializers fit on a single line. Enabling this for
Google style now as t

Improved formatting of constructor initializers

Added option to put each constructor initializer on its own line
if not all initializers fit on a single line. Enabling this for
Google style now as the style guide (arguable) suggests it. Not
sure whether we also want it for LLVM.

llvm-svn: 172196

show more ...


# 71f95e05 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Remove a fixme, Jordy says @synthesize is good as is.

llvm-svn: 172141


# 9efe291f 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Put spaces in ObjC method decls in the right place for Google style.

Objective-C method declarations look like this:

- (returntype)name:(type)argname anothername:(type)arg2name;

In goog

Formatter: Put spaces in ObjC method decls in the right place for Google style.

Objective-C method declarations look like this:

- (returntype)name:(type)argname anothername:(type)arg2name;

In google style, there's no space after the leading '-' but one after
"(returntype)" instead (but none after the argument types), see
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions

Not inserting the space after '-' is easy, but to insert the space after the
return type, the formatter needs to know that a closing parenthesis ends the
return type. To do this, I tweaked the code in parse() to check for this, which
in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to
parse(), because parse() runs before annotate().

(To keep things interesting, the return type is optional, but it's almost
always there in practice.)

http://llvm-reviews.chandlerc.com/D280

llvm-svn: 172140

show more ...


# a2a8495e 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: No spaces around '=' in @property lines.

Before:
@property(assign, getter = isEditable) BOOL editable;

Now:
@property(assign, getter=isEditable) BOOL editable;

It'd be nice if some Appl

Formatter: No spaces around '=' in @property lines.

Before:
@property(assign, getter = isEditable) BOOL editable;

Now:
@property(assign, getter=isEditable) BOOL editable;

It'd be nice if some Apple person could let me know if spaces are preferred
around '=' in @synthesize lines (see FIXME in the test).

llvm-svn: 172110

show more ...


# d6f962f1 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add test for template and protocol parameters in ObjC method declarations.

llvm-svn: 172100


# a608775b 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatting: In @implementation etc lines, put a space before protocol lists.

Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols

Most oth

Formatting: In @implementation etc lines, put a space before protocol lists.

Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols

Most other places (function declarations, variable declarations) still get
this wrong, and since this looks very similiar to template instantiations to
the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some
places.

llvm-svn: 172099

show more ...


# a1a5abd5 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Don't put a space in ObjC number literals like @+50

Before:
@ -4.5

Now:
@-4.5

llvm-svn: 172095


# 2bb00742 10-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add space before '(' in @implemenation, @interface, @protocol lines

The first token in @implementation, @interface, and @protocol lines is now
marked TT_ObjCDecl, and lines starting with

Formatter: Add space before '(' in @implemenation, @interface, @protocol lines

The first token in @implementation, @interface, and @protocol lines is now
marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked
LT_ObjCMethodDecl.

llvm-svn: 172093

show more ...


# 0ddd57a1 10-Jan-2013 Manuel Klimek <klimek@google.com>

Fixes layout of right braces.

We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.

For example, we now insert a ne

Fixes layout of right braces.

We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.

For example, we now insert a newline before '};' in:
static SomeClass WithALoooooooooooooooooooongName = {
100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"
};
... while not inserting a newline here:
static SomeClass = { a, b, c, d, e, f, g, h, i, j,
looooooooooooooooooooooooooooooooooongname,
looooooooooooooooooooooooooooooong };

Also fixes the formating of (column limit 25):
int x = {
avariable,
b(alongervariable)
};

llvm-svn: 172076

show more ...


# 73a2fdf2 10-Jan-2013 Manuel Klimek <klimek@google.com>

Fixes formatting of function calls etc inside an initializer list.

We're now formatting (column limit 25):
int x = {
avariable,
b(alongervariable) };

This also fixes:
Aaa({
int i;
}, aaaaaaaa

Fixes formatting of function calls etc inside an initializer list.

We're now formatting (column limit 25):
int x = {
avariable,
b(alongervariable) };

This also fixes:
Aaa({
int i;
}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccc));
... where we would previously break after the '},'.

Putting the closing curly into an extra line when there's a break
directly after the first curly will be done in a subsequent patch.

Paired with djasper.

llvm-svn: 172070

show more ...


# e7d10a1f 10-Jan-2013 Manuel Klimek <klimek@google.com>

Do not add newline in empty blocks.

void f() {}
now gets formatted in one line.

llvm-svn: 172067


# c1fa2813 10-Jan-2013 Daniel Jasper <djasper@google.com>

Improvements to function type and ObjC block formatting.

Before: int (^myBlock) (int) = ^(int num) {}
A<void ()>;
int (*b)(int);

After: int (^myBlock)(int) = ^(int num) {}
A<void(

Improvements to function type and ObjC block formatting.

Before: int (^myBlock) (int) = ^(int num) {}
A<void ()>;
int (*b)(int);

After: int (^myBlock)(int) = ^(int num) {}
A<void()>;
int(*b)(int);

For function types and function pointer types, this patch only makes
the behavior consistent (for types that are keywords and other types).
For the latter function pointer type declarations, we'll probably
want to add a space after "int".

Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately
Moved the LangOpts-settings to a public place for use by tests
and clang-format binary.

llvm-svn: 172065

show more ...


# 8e07a1b6 10-Jan-2013 Manuel Klimek <klimek@google.com>

Fix layout of blocks inside statements.

Previously, we would not indent:
SOME_MACRO({
int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO(

Fix layout of blocks inside statements.

Previously, we would not indent:
SOME_MACRO({
int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.

Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };

llvm-svn: 172058

show more ...


# 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 ...


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