History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1276 – 1300 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 14e58e52 21-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Preserve meaning of trailing comments on parameters.

Formatting:
SomeFunction(a,
b, // comment
c);

Before:
SomeFunction(a, b, // comment
c);

clang-format: Preserve meaning of trailing comments on parameters.

Formatting:
SomeFunction(a,
b, // comment
c);

Before:
SomeFunction(a, b, // comment
c);

After:
SomeFunction(a,
b, // comment
c);

llvm-svn: 204456

show more ...


# ce081267 18-Mar-2014 Alexander Kornienko <alexfh@google.com>

clang-format: Detect function-like macros only when upper case is used.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

clang-format: Detect function-like macros only when upper case is used.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 204156

show more ...


# 819788da 18-Mar-2014 Manuel Klimek <klimek@google.com>

Fix crasher bug.

Due to not resetting the fake rparen data on the token when iterating
over annotated lines, we would pop the last element of the paren stack.

This patch fixes the underlying root c

Fix crasher bug.

Due to not resetting the fake rparen data on the token when iterating
over annotated lines, we would pop the last element of the paren stack.

This patch fixes the underlying root cause, and makes the code more
robust against similar problems in the future:
- reset the first token when iterating on the same annotated lines due
to preprocessor branches
- never pop the last element from the paren stack, so we do not crash,
but rather incorrectly format
- add assert()s so we can figure out if our assumptions are violated

llvm-svn: 204140

show more ...


# 1fd6f1f8 17-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Indent from dict literal labels.

Before:
@{
NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont,
};

After:
@{
NSFontAttributeNameeeeeeeeeeeee

clang-format: Indent from dict literal labels.

Before:
@{
NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont,
};

After:
@{
NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont,
};

llvm-svn: 204041

show more ...


# ac7e34e7 13-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Prevent ObjC code from confusing the braced-init detection

This was leading to bad formatting, e.g.:
Before:
f(^{
@autoreleasepool {
if (a) {
g();
}
}
}

clang-format: Prevent ObjC code from confusing the braced-init detection

This was leading to bad formatting, e.g.:
Before:
f(^{
@autoreleasepool {
if (a) {
g();
}
}
});

After:
f(^{
@autoreleasepool {
if (a) {
g();
}
}
});

llvm-svn: 203777

show more ...


# da353cd5 12-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix crasher.

Caused by unknown tokens (e.g. "\n") not properly updating the state.

Example:
const char* c = STRINGIFY(
\na : b);

llvm-svn: 203645


# 8f59ae53 11-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Avoid unnecessary break before lambda return type.

Before:
auto aaaaaaaa = [](int i, // break
int j)
-> int {
return fffffffffffffffff

clang-format: Avoid unnecessary break before lambda return type.

Before:
auto aaaaaaaa = [](int i, // break
int j)
-> int {
return fffffffffffffffffffffffffffffffffffffff(i * j);
};

After:
auto aaaaaaaa = [](int i, // break
int j) -> int {
return fffffffffffffffffffffffffffffffffffffff(i * j);
};

llvm-svn: 203562

show more ...


# a58dd5db 11-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix another false positive in the lambda detection.

Before:
int i = (*b)[a] -> f();

After:
int i = (*b)[a]->f();

llvm-svn: 203557


# d3c7ab97 11-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix incorrect lambda recognition exposed by r203452.

Before:
int i = a[a][a] -> f();

After:
int i = a[a][a]->f();

llvm-svn: 203556


# c580af96 11-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Detect weird macro lambda usage.

Before:
void f() {
MACRO((const AA & a) { return 1; });
}

After:
void f() {
MACRO((const AA &a) { return 1; });
}

llvm-svn: 203551


# 84a12e18 10-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Add spaces between lambdas and comments.

Before:
void f() {
bar([]() {}// Does not respect SpacesBeforeTrailingComments
);
}

After:
void f() {
bar([]() {} // Doe

clang-format: Add spaces between lambdas and comments.

Before:
void f() {
bar([]() {}// Does not respect SpacesBeforeTrailingComments
);
}

After:
void f() {
bar([]() {} // Does not respect SpacesBeforeTrailingComments
);
}

This fixes llvm.org/PR19017.

llvm-svn: 203466

show more ...


# 4504f939 10-Mar-2014 Alexander Kornienko <alexfh@google.com>

Preserve hanging indent when breaking line comments.

Summary:
If we need to break the second line here:
// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa aaaa

Preserve hanging indent when breaking line comments.

Summary:
If we need to break the second line here:
// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa aaaaa

with the patch it will be turned to

// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa

instead of

// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 203458

show more ...


# 81a20787 10-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Add spaces around trailing/lambda return types.

Before:
int c = []()->int { return 2; }();

After:
int c = []() -> int { return 2; }();

llvm-svn: 203452


# 86b2dfdc 06-Mar-2014 Alexander Kornienko <alexfh@google.com>

Fix operator<< recognition (PR19064).

llvm-svn: 203123


# f8b7266d 02-Mar-2014 Chandler Carruth <chandlerc@gmail.com>

[C++11] Switch the clang-format LLVM style to use C++11 style braced
init list formatting. This suggestion has now gone into the LLVM coding
standards, and is particularly relevant now that we're usi

[C++11] Switch the clang-format LLVM style to use C++11 style braced
init list formatting. This suggestion has now gone into the LLVM coding
standards, and is particularly relevant now that we're using C++11.

Updated a really ridiculous number of tests to reflect this change.

llvm-svn: 202637

show more ...


# 5550de68 17-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Don't wrap "const" etc. of function declarations.

Generally people seem to prefer wrapping the first function parameter
over wrapping the trailing tokens "const", "override" and "final

clang-format: Don't wrap "const" etc. of function declarations.

Generally people seem to prefer wrapping the first function parameter
over wrapping the trailing tokens "const", "override" and "final". This
does not extend to function-like annotations and probably not to other
non-standard annotations.

Before:
void someLongFunction(int SomeLongParameter)
const { ... }

After:
void someLongFunction(
int SomeLongParameter) const { ... }

llvm-svn: 201504

show more ...


# 3a122c02 14-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix formatting of class template declaration.

Before:
template <class R, class C>
struct Aaaaaaaaaaaaaaaaa<R (C::*)(int)
const> : Aaaaaaaaaaaaaaaaa<R (C:

clang-format: Fix formatting of class template declaration.

Before:
template <class R, class C>
struct Aaaaaaaaaaaaaaaaa<R (C::*)(int)
const> : Aaaaaaaaaaaaaaaaa<R (C::*)(int)> {};

After:
template <class R, class C>
struct Aaaaaaaaaaaaaaaaa<R (C::*)(int) const>
: Aaaaaaaaaaaaaaaaa<R (C::*)(int)> {};

llvm-svn: 201424

show more ...


# 1067ab0a 11-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Support lambdas with namespace-qualified return types.

E.g.:
Foo([]()->std::vector<int> { return { 2 }; }());

llvm-svn: 201139


# a0407740 11-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix alignment of comments inside statements.

Before:
auto result = SomeObject
// Calling someFunction on SomeObject
.someFunction();

After:
aut

clang-format: Fix alignment of comments inside statements.

Before:
auto result = SomeObject
// Calling someFunction on SomeObject
.someFunction();

After:
auto result = SomeObject
// Calling someFunction on SomeObject
.someFunction();

llvm-svn: 201138

show more ...


# 64989968 07-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix column limit violation for merged lines in macros.

Before (81 columns):
#define A \
void aaaaaaaaaaaaaaa

clang-format: Fix column limit violation for merged lines in macros.

Before (81 columns):
#define A \
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { return aaaaaaaa; } \
int i;

After:
#define A \
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { \
return aaaaaaaa; \
} \
int i;

llvm-svn: 200974

show more ...


# 9cc3e976 07-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix range-based for-loop formatting.

Before:
for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaa.aaaaaaaaaaaa()
.aaaaaaaaa()
.a()) {
}

After:
for (aaaaaaaa

clang-format: Fix range-based for-loop formatting.

Before:
for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaa.aaaaaaaaaaaa()
.aaaaaaaaa()
.a()) {
}

After:
for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa :
aaaaaaaaaaaa.aaaaaaaaaaaa().aaaaaaaaa().a()) {
}

llvm-svn: 200968

show more ...


# 0c214fa2 05-Feb-2014 Daniel Jasper <djasper@google.com>

clang-format: Don't indent relative to unary operators.

It seems like most people see unary operators more like part of the
subsequent identifier and find relative indentation odd.

Before:
aaaaaa

clang-format: Don't indent relative to unary operators.

It seems like most people see unary operators more like part of the
subsequent identifier and find relative indentation odd.

Before:
aaaaaaaaaa(!aaaaaaaaaa( // break
aaaaa));
After:
aaaaaaaaaa(!aaaaaaaaaa( // break
aaaaa));

llvm-svn: 200840

show more ...


# 514ecc8c 02-Feb-2014 Nico Weber <nicolasweber@gmx.de>

clang-format: Let chromium style inherit google style's javascript tweaks.

llvm-svn: 200652


# a88f80a1 30-Jan-2014 Daniel Jasper <djasper@google.com>

clang-format: Support ObjC's NS_ENUMs.

Before:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anot

clang-format: Support ObjC's NS_ENUMs.

Before:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue};

After:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue
};

llvm-svn: 200469

show more ...


# 14bd9174 29-Jan-2014 Manuel Klimek <klimek@google.com>

Fix crash on unmatched #endif's.

The following snippet would crash:
#endif
#if A

llvm-svn: 200381


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