History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1401 – 1425 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1db6c386 22-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve formatting of ObjC array literals.

Before:
NSArray *arguments =
@[ kind == kUserTicket ? @"--user-store" : @"--system-store",
@"--print-tickets", @"--productid

clang-format: Improve formatting of ObjC array literals.

Before:
NSArray *arguments =
@[ kind == kUserTicket ? @"--user-store" : @"--system-store",
@"--print-tickets", @"--productid", @"com.google.Chrome" ];
After:
NSArray *arguments = @[
kind == kUserTicket ? @"--user-store" : @"--system-store",
@"--print-tickets",
@"--productid",
@"com.google.Chrome"
];

This fixes llvm.org/PR15231.

llvm-svn: 193167

show more ...


# f6fd3d3f 22-Oct-2013 Manuel Klimek <klimek@google.com>

Remove incorrect assert.

If we run into the second preprocessor branch chain, the first branch
chain might have already set the maximum branch count on that level to
something > 0.

Fixes PR17645.

Remove incorrect assert.

If we run into the second preprocessor branch chain, the first branch
chain might have already set the maximum branch count on that level to
something > 0.

Fixes PR17645.

llvm-svn: 193153

show more ...


# 88033d7a 21-Oct-2013 Manuel Klimek <klimek@google.com>

Fixes PR17617: Crash on joining short if statements.

Now that we iterate on the formatting multiple times when we
have chains of preprocessor branches, we need to correctly reset
the token's previou

Fixes PR17617: Crash on joining short if statements.

Now that we iterate on the formatting multiple times when we
have chains of preprocessor branches, we need to correctly reset
the token's previous and next pointer for the first / last token.

llvm-svn: 193071

show more ...


# d46e07e2 20-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Better understand Lambda poarameters.

Before:
auto PointerBinding = [](const char * S) {};

After:
auto PointerBinding = [](const char *S) {};

This fixes llvm.org/PR17618.

llvm-s

clang-format: Better understand Lambda poarameters.

Before:
auto PointerBinding = [](const char * S) {};

After:
auto PointerBinding = [](const char *S) {};

This fixes llvm.org/PR17618.

llvm-svn: 193054

show more ...


# dcd5da1f 20-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix formatting of nested blocks after comment.

Before:
DEBUG({ // Comment that used to confuse clang-format.
fdafas();
});
Before:
DEBUG({ // Comments are now fine.
fdafas(

clang-format: Fix formatting of nested blocks after comment.

Before:
DEBUG({ // Comment that used to confuse clang-format.
fdafas();
});
Before:
DEBUG({ // Comments are now fine.
fdafas();
});

This fixed llvm.org/PR17619.

llvm-svn: 193051

show more ...


# 2d0cd497 20-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Support case ranges.

Before (note the missing space before "..." which can lead to compile
errors):
switch (x) {
case 'A'... 'Z':
case 1... 5:
break;
}

After:
sw

clang-format: Support case ranges.

Before (note the missing space before "..." which can lead to compile
errors):
switch (x) {
case 'A'... 'Z':
case 1... 5:
break;
}

After:
switch (x) {
case 'A' ... 'Z':
case 1 ... 5:
break;
}

llvm-svn: 193050

show more ...


# d489dd34 20-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve formatting of ObjC dict literals.

Before:
NSDictionary *d = @{ @"nam" : NSUserNam(), @"dte" : [NSDate date],
@"processInfo" : [NSProcessInfo processInf

clang-format: Improve formatting of ObjC dict literals.

Before:
NSDictionary *d = @{ @"nam" : NSUserNam(), @"dte" : [NSDate date],
@"processInfo" : [NSProcessInfo processInfo]
};

After:
NSDictionary *d = @{
@"nam" : NSUserNam(),
@"dte" : [NSDate date],
@"processInfo" : [NSProcessInfo processInfo]
};

llvm-svn: 193049

show more ...


# fbc057ea 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Be more aggressive on incorrect code.

Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has

clang-format: Be more aggressive on incorrect code.

Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has gotten good enough at parsing the code structure that
this hurts in almost all cases. Commonly, while writing code, it is
very useful to be able to correclty indent incomplete if statements or
for loops.

In case this leads to errors that we don't anticipate, we need to find
out and fix those.

This fixed llvm.org/PR17594.

llvm-svn: 192988

show more ...


# 2436fe95 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Don't force linebreak between return and multiline string.

This looks ugly and leads to llvm.org/PR17590.

Before (with AlwaysBreakBeforeMultilineStrings):
return
"aaaa"

clang-format: Don't force linebreak between return and multiline string.

This looks ugly and leads to llvm.org/PR17590.

Before (with AlwaysBreakBeforeMultilineStrings):
return
"aaaa"
"bbbb";

After:
return "aaaa"
"bbbb";

llvm-svn: 192984

show more ...


# d8c36d09 18-Oct-2013 Daniel Jasper <djasper@google.com>

Make clang-format slightly more willing to break before trailing annotations.

Specifically, prefer breaking before trailing annotations over breaking
before the first parameter.

Before:
void ffff

Make clang-format slightly more willing to break before trailing annotations.

Specifically, prefer breaking before trailing annotations over breaking
before the first parameter.

Before:
void ffffffffffffffffffffffff(
int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE;

After:
void ffffffffffffffffffffffff(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
OVERRIDE;

llvm-svn: 192983

show more ...


# cc3114d8 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve formatting of templated builder-type calls.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa().has<
bbbbbbbbbbbbbbbbbbbbb>();

After:
aaaaaa

clang-format: Improve formatting of templated builder-type calls.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa().has<
bbbbbbbbbbbbbbbbbbbbb>();

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaa()
.aaaaaaaaaaaaaaaaaaaaaaaaaa()
.has<bbbbbbbbbbbbbbbbbbbbb>();

llvm-svn: 192981

show more ...


# 6633ab8a 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Make continuation indent width configurable.

Patch by Kim Gräsman. Thank you!

llvm-svn: 192964


# e2e0387f 14-Oct-2013 Alexander Kornienko <alexfh@google.com>

Keep track of indentation levels in static initializers for correct indentation with tabs.

Summary:
Store IndentationLevel in ParentState and use it instead of the
Line::Level when indening.
Also fi

Keep track of indentation levels in static initializers for correct indentation with tabs.

Summary:
Store IndentationLevel in ParentState and use it instead of the
Line::Level when indening.
Also fixed incorrect indentation level calculation in formatFirstToken.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192563

show more ...


# b212f3ba 12-Oct-2013 Manuel Klimek <klimek@google.com>

Automatically munch semicolons after blocks.

While it is mostly a user error to have the extra semicolon,
formatting it graciously will correctly format in the cases
where we do not fully understand

Automatically munch semicolons after blocks.

While it is mostly a user error to have the extra semicolon,
formatting it graciously will correctly format in the cases
where we do not fully understand the code (macros).

llvm-svn: 192543

show more ...


# 53bd167c 12-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix assertion on unterminated #ifs.

llvm-svn: 192535


# fba84ff0 12-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: No space in "<::" in C++11 mode.

llvm-svn: 192524


# 384b40b9 11-Oct-2013 Alexander Kornienko <alexfh@google.com>

Don't break string literals inside preprocessor directives.

Summary:
This way we avoid breaking code which uses unknown preprocessor
directives with long string literals. The specific use case in
ht

Don't break string literals inside preprocessor directives.

Summary:
This way we avoid breaking code which uses unknown preprocessor
directives with long string literals. The specific use case in
http://llvm.org/PR17035 isn't very common, but it seems to be a good idea to
avoid this kind of problem anyway.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192507

show more ...


# 71814b44 11-Oct-2013 Manuel Klimek <klimek@google.com>

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifde

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifdef A
MyType<Some> >
#else
Type1, Type2>
#endif
param2,
#endif
param3) {
f();
}

llvm-svn: 192503

show more ...


# 877615cc 11-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Don't remove 'unknown' tokens.

In certain macros or incorrect string literals, the token stream can
contain 'unknown' tokens, e.g. a single backslash or a set of empty
ticks. clang-for

clang-format: Don't remove 'unknown' tokens.

In certain macros or incorrect string literals, the token stream can
contain 'unknown' tokens, e.g. a single backslash or a set of empty
ticks. clang-format simply treated them as whitespace and removed them
prior to this patch.

This fixes llvm.org/PR17215

llvm-svn: 192490

show more ...


# 60d1b046 10-Oct-2013 Alexander Kornienko <alexfh@google.com>

Correctly detect colon in bit fields. Fixes PR17333.

Summary: Colon was incorrectly detected as a start of inheritance list. Fixed.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Correctly detect colon in bit fields. Fixes PR17333.

Summary: Colon was incorrectly detected as a start of inheritance list. Fixed.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192349

show more ...


# d3e014d4 09-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix template declaration line breaking with comment.

Before, clang-format would always insert a linebreak before the comment
in code like:
template <typename T> // T can be A, B or C

clang-format: Fix template declaration line breaking with comment.

Before, clang-format would always insert a linebreak before the comment
in code like:
template <typename T> // T can be A, B or C.
struct S {};

llvm-svn: 192297

show more ...


# f9a5e404 08-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve indentation when deriving from templated classes.

Before:
struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< //
aaaaaaaaaaaaaaaa> {};
struct aaaaaaaaaaaaaaaaaaaa : pu

clang-format: Improve indentation when deriving from templated classes.

Before:
struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< //
aaaaaaaaaaaaaaaa> {};
struct aaaaaaaaaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa<
aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa> {};

After:
struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< //
aaaaaaaaaaaaaaaa> {};
struct aaaaaaaaaaaaaaaaaaaa
: public aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaa> {};

llvm-svn: 192187

show more ...


# ec01cd6e 08-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve constructor initializer linewrapping.

Specifically make ConstructorInitializerAllOnOneLineOrOnePerLine work
nicely with BreakConstructorInitializersBeforeComma.

This fixes llv

clang-format: Improve constructor initializer linewrapping.

Specifically make ConstructorInitializerAllOnOneLineOrOnePerLine work
nicely with BreakConstructorInitializersBeforeComma.

This fixes llvm.org/PR17395.

llvm-svn: 192168

show more ...


# 91e48586 07-Oct-2013 Manuel Klimek <klimek@google.com>

Fix incorrect detection of class definitions with alignas specification.

llvm-svn: 192094


# 320997e6 06-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Remove empty lines after visibility modifiers.

Formatting:
class C {
public:

f();
};

Now leads to:
class C {
public:
f();
};

llvm-svn: 192062


1...<<51525354555657585960>>...82