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

Formatter: Add support for @implementation.

Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.

llvm-svn: 1

Formatter: Add support for @implementation.

Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.

llvm-svn: 172019

show more ...


# d8ffe75a 09-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Make parseObjCUntilAtEnd() actually work.

llvm-svn: 172003


# 8696a8d9 09-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatting: Add support for @protocol.

Pull pieces of the @interface code into reusable methods.

llvm-svn: 172001


# 7eecf4b6 09-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add support for @interface.

Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.

llvm-svn: 171995


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


# 4cc9874f 08-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: More tests for already-passing ObjC bits.

llvm-svn: 171892


# 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


# d8cdb53e 08-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: More ObjC tests.

llvm-svn: 171883


# 7e6a7a19 08-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Add tests for some ObjC bits that happen to be formatted correctly.

llvm-svn: 171875


# 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


# 28cacc74 07-Jan-2013 Manuel Klimek <klimek@google.com>

Fix parsing of variable declarations directly after a class / struct.

Previous indent:
class A {
}
a;
void f() {
};

With this patch:
class A {
} a;
void f() {
}
;

The patch introduces a production

Fix parsing of variable declarations directly after a class / struct.

Previous indent:
class A {
}
a;
void f() {
};

With this patch:
class A {
} a;
void f() {
}
;

The patch introduces a production for classes and structs, and parses
the rest of the line to the semicolon after the class scope.
This allowed us to remove a long-standing wart in the parser that would
just much the semicolon after any block.
Due to this suboptimal formating some tests were broken.

Some unrelated formatting tests broke; those hit a bug in the ast
printing, and need to be fixed separately.

llvm-svn: 171761

show more ...


# 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


# 803d61d1 07-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Test all @keywords. Turns out some of them are not formatted correctly yet.

llvm-svn: 171752


# 12d5babb 07-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Slightly expand the @ test to cover whitespace between @ and keyword.

llvm-svn: 171751


# a887650c 07-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Add a test that checks that the formatter doesn't discard '@' with ObjC1 set.

Also set ObjC1 in the formatter tests.

The only effect of this flag in the lexer is that '@' now gets turned into
tok::

Add a test that checks that the formatter doesn't discard '@' with ObjC1 set.

Also set ObjC1 in the formatter tests.

The only effect of this flag in the lexer is that '@' now gets turned into
tok::at instead of tok::unknown.

llvm-svn: 171742

show more ...


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