History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1326 – 1350 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 352dae19 03-Jan-2014 Daniel Jasper <djasper@google.com>

clang-format: Recognize single-line macro usages inside macros.

Before:
#define LIST(L) \
L(FirstElement) L(SecondElement) L(ThirdElement) L

clang-format: Recognize single-line macro usages inside macros.

Before:
#define LIST(L) \
L(FirstElement) L(SecondElement) L(ThirdElement) L(FourthElement) \
L(FifthElement)

After:
#define LIST(L) \
L(FirstElement) \
L(SecondElement) \
L(ThirdElement) \
L(FourthElement) \
L(FifthElement)

llvm-svn: 198407

show more ...


# ce9161a5 02-Jan-2014 Alexander Kornienko <alexfh@google.com>

Added an option to avoid splitting certain kinds of comments into lines.

Summary: Added CommentPragmas option for this.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

Dif

Added an option to avoid splitting certain kinds of comments into lines.

Summary: Added CommentPragmas option for this.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 198310

show more ...


# d6bd7474 30-Dec-2013 Alexander Kornienko <alexfh@google.com>

Changed the test to avoid EXPECT_EQ(false, ...), which leads to
-Wconversion-null warning in GCC.

llvm-svn: 198214


# 126153ab 27-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Break default arguments less eagerly.

Before:
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa =
1);

After:
v

clang-format: Break default arguments less eagerly.

Before:
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa =
1);

After:
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
int aaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1);

llvm-svn: 198070

show more ...


# 234379fb 24-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: (WebKit) Disallow 1-line constructors with initializers.

Before:
Constructor() : a(a) {}

After:
Constructor()
: a(a)
{
}

This style guide is pretty precise about this.

clang-format: (WebKit) Disallow 1-line constructors with initializers.

Before:
Constructor() : a(a) {}

After:
Constructor()
: a(a)
{
}

This style guide is pretty precise about this.

llvm-svn: 197980

show more ...


Revision tags: llvmorg-3.4.0
# b88b25fe 23-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix various problems in formatting ObjC blocks.

Among other things, this fixes llvm.org/PR15269.

llvm-svn: 197900


# 04b6a081 20-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Better support for multi-line wide string literals.

Before:
SomeFunction(L"A" L"B");

After:
SomeFunction(L"A"
L"B");

llvm-svn: 197785


# 5a611397 19-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Add special case for leading comments in braced lists.

A comment following the "{" of a braced list seems to almost always
refer to the first element of the list and thus should be ali

clang-format: Add special case for leading comments in braced lists.

A comment following the "{" of a braced list seems to almost always
refer to the first element of the list and thus should be aligned
to it.

Before (with Cpp11 braced list style):
SomeFunction({ // Comment 1
"first entry",
// Comment 2
"second entry"});
After:
SomeFunction({// Comment 1
"first entry",
// Comment 2
"second entry"});

llvm-svn: 197725

show more ...


# 19a541ef 19-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Increase penalty for breaking comments.

Unexpectedly, it seems that people commonly know what they were doing
when writing a comment.

Also, being more conservative about comment break

clang-format: Increase penalty for breaking comments.

Unexpectedly, it seems that people commonly know what they were doing
when writing a comment.

Also, being more conservative about comment breaking has the advantage
of giving more flexibility. If a linebreak within the comment can
improve formatting, the author can add it (after which clang-format
won't undo it). There is no way to override clang-format's behavior if
it breaks a comment.

llvm-svn: 197698

show more ...


# 004177ee 19-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Slightly adapt decision of when to break before <<.

Before:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaa

clang-format: Slightly adapt decision of when to break before <<.

Before:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaa);

After:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa);

llvm-svn: 197690

show more ...


# 96964359 18-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix indentation corner case.

Before:
aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaa

clang-format: Fix indentation corner case.

Before:
aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

After:
aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

Probably still not ideal, but should be a step into the right direction.

llvm-svn: 197557

show more ...


# 3460b254 18-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix ObjC method expr in binary expressions.

Before:
bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] ==
aa

clang-format: Fix ObjC method expr in binary expressions.

Before:
bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] ==
aaaaaaaaaaaaaaaaaaaa);

After:
bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa ||
[aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa);

This fixes llvm.org/PR18271.

llvm-svn: 197552

show more ...


# bad63ae2 17-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Don't adapt local format to macros.

Formatting this:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this lin

clang-format: Don't adapt local format to macros.

Formatting this:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}

Before:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}

After:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}

llvm-svn: 197494

show more ...


Revision tags: llvmorg-3.4.0-rc3
# 43e6a28d 16-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Keep trailing annotations together.

Before:
virtual void aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa, aaaaaaaaaaa aaaaa) const
override;
virtual void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

clang-format: Keep trailing annotations together.

Before:
virtual void aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa, aaaaaaaaaaa aaaaa) const
override;
virtual void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() const
override;

After:
virtual void aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa,
aaaaaaaaaaa aaaaa) const override;
virtual void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
const override;

llvm-svn: 197391

show more ...


# a594ba8a 16-Dec-2013 Alexander Kornienko <alexfh@google.com>

Always break before the colon in constructor initializers, when
BreakConstructorInitializersBeforeComma is true.

This option is used in WebKit style, so this also ensures initializer lists are
not p

Always break before the colon in constructor initializers, when
BreakConstructorInitializersBeforeComma is true.

This option is used in WebKit style, so this also ensures initializer lists are
not put on a single line, as per the WebKit coding guidelines.

Patch by Florian Sowade!

llvm-svn: 197386

show more ...


# 3682fcda 16-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix formatting of function type parameters.

Before:
void f() { typedef void (*f)(int * a); }
After:
void f() { typedef void (*f)(int *a); }

llvm-svn: 197369


# c39b56fe 16-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve handling of raw string literals.

Especially try to keep existing line breaks before raw string literals,
as the code author might have aligned content to it.

Thereby, clang-fo

clang-format: Improve handling of raw string literals.

Especially try to keep existing line breaks before raw string literals,
as the code author might have aligned content to it.

Thereby, clang-format now keeps things like:

parseStyle(R"(
BasedOnStyle: Google,
ColumnLimit: 100)");
parseStyle(
R"(BasedOnStyle: Google,
ColumnLimit: 100)");

llvm-svn: 197368

show more ...


# 3a33f029 12-Dec-2013 Alexander Kornienko <alexfh@google.com>

Implemented GNU-style formatting for compound statements.

Summary:
Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of
static initializer formatting, but compound statements shou

Implemented GNU-style formatting for compound statements.

Summary:
Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of
static initializer formatting, but compound statements should be fine.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 197138

show more ...


# fe7a57fa 10-Dec-2013 Alexander Kornienko <alexfh@google.com>

Early attempts to format in GNU style.

Summary:
This still misses a few important features, so there's no mention of
this style in the help message, but a few style rules are implemented.

Reviewers

Early attempts to format in GNU style.

Summary:
This still misses a few important features, so there's no mention of
this style in the help message, but a few style rules are implemented.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196928

show more ...


# c1637f16 10-Dec-2013 Alexander Kornienko <alexfh@google.com>

Allow predefined styles to define different options for different languages.

Summary:
Allow predefined styles to define different options for different
languages so that one can run:
clang-format

Allow predefined styles to define different options for different languages.

Summary:
Allow predefined styles to define different options for different
languages so that one can run:
clang-format -style=google file1.cpp file2.js

or use a single .clang-format file with "BasedOnStyle: Google" for both c++ and
JS files.

Added Google style for JavaScript with "BreakBeforeTernaryOperators" set to
false.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196909

show more ...


# fdca83d4 10-Dec-2013 Alexander Kornienko <alexfh@google.com>

Support GNU style rule to put a space before opening parenthesis.

Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and

Support GNU style rule to put a space before opening parenthesis.

Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and after the commas."

http://www.gnu.org/prep/standards/standards.html#index-spaces-before-open_002dparen

This patch makes clang-format adds an option to put spaces before almost all open parentheses, except the cases, where different behavior is dictated by the style rules or language syntax:
* preprocessor:
** function-like macro definitions can't have a space between the macro name and the parenthesis;
** `#if defined(...)` can have a space, but it seems, that it's more frequently used without a space in GCC, for example;
* never add spaces after unary operators;
* adding spaces between two opening parentheses is controlled with the `SpacesInParentheses` option;
* never add spaces between `[` and `(` (there's no option yet).

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196901

show more ...


# 63af7c48 09-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Be more conservative about braced list column layout.

Specifically disable it for nested braced lists as it commonly can look
really weird. Eventually, we'll want to become smarter and

clang-format: Be more conservative about braced list column layout.

Specifically disable it for nested braced lists as it commonly can look
really weird. Eventually, we'll want to become smarter and format some of
the nested lists better.

Before:
SomeStruct my_struct_array = {
{ aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa,
aaaaaaaaaa, aaaaaaaaaa, aaaaaaa, aaa },
{ aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
{ aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaa, a, aaaaaaaaaa,
aaaaaaaaa, aaa },
};

After:
SomeStruct my_struct_array = {
{ aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa,
aaaaaaaaaaaa, aaaaaaa, aaa },
{ aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
{ aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa },
};

llvm-svn: 196783

show more ...


# e0ab9e79 06-Dec-2013 Daniel Jasper <djasper@google.com>

clang-format: Change line break decisions for array subscripts.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
[aaaaaaaaaaaa];
After:
aaaaaaaaaaaaaaaaaaa

clang-format: Change line break decisions for array subscripts.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
[aaaaaaaaaaaa];
After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];

llvm-svn: 196582

show more ...


# f6a24ce4 05-Dec-2013 Alp Toker <alp@nuanti.com>

Fix a tranche of comment, test and doc typos

llvm-svn: 196510


# 06dd15a0 04-Dec-2013 Alexander Kornienko <alexfh@google.com>

Added a regression test for the change in r196380

llvm-svn: 196384


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