History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 976 – 1000 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# f090f031 18-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Support function annotations in macros.

Before:
DEPRECATED("Use NewClass::NewFunction instead.") string
OldFunction(const string &parameter) {}

After:
DEPRECATED("Use NewCla

clang-format: Support function annotations in macros.

Before:
DEPRECATED("Use NewClass::NewFunction instead.") string
OldFunction(const string &parameter) {}

After:
DEPRECATED("Use NewClass::NewFunction instead.")
string OldFunction(const string &parameter) {}

llvm-svn: 237562

show more ...


# 0928553e 17-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Properly align ObjC string literals.

Before:
NSString s = @"a"
"b"
"c";
NSString s = @"a"
@"b"
@"c";

After:
NSString

clang-format: Properly align ObjC string literals.

Before:
NSString s = @"a"
"b"
"c";
NSString s = @"a"
@"b"
@"c";

After:
NSString s = @"a"
"b"
"c";
NSString s = @"a"
@"b"
@"c";

This fixes llvm.org/PR23536.

llvm-svn: 237538

show more ...


# 2fd16632 17-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Improve line wrapping around << operators.

Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
jus

clang-format: Improve line wrapping around << operators.

Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.

Before:
llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa,
aaaaaaaaa);

After:
llvm::errs() << "aaaaaaaaaaaa: "
<< aaaaaaa(aaaaaaaaa, aaaaaaaaa);

Also remove old test case that was testing actual behavior any more.

llvm-svn: 237535

show more ...


Revision tags: llvmorg-3.6.1
# 3ca283ad 15-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Slightly change format decisions around macro annotations.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
bool aaaa

clang-format: Slightly change format decisions around macro annotations.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
aaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 237430

show more ...


# 731dde91 15-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes mo

clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.

llvm-svn: 237427

show more ...


# cdb58b2e 15-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Add missing space before ObjC selector.

Before:
[self aaaaa:(1 + 2)bbbbb:3];

After:
[self aaaaa:(1 + 2) bbbbb:3];

llvm-svn: 237424


# c4144ea4 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators.

Basically, it doesn't seem right to indent a nested block aligned to a
binary or ternary operat

clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators.

Basically, it doesn't seem right to indent a nested block aligned to a
binary or ternary operator.

Before:
int i = aaaaaa ? 1 //
: [] {
return 2; //
}();
llvm::errs() << "number of twos is "
<< std::count_if(v.begin(), v.end(), [](int x) {
return x == 2; // force break
});

After:
int i = aaaaaa ? 1 //
: [] {
return 2; //
}();
llvm::errs() << "number of twos is "
<< std::count_if(v.begin(), v.end(), [](int x) {
return x == 2; // force break
});

llvm-svn: 237263

show more ...


# 3a26a8db 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Fix incorrect */& classification.

Before:
void f() { f(new a(), c *d); }

After:
void f() { f(new a(), c * d); }

llvm-svn: 237249


# e60cba13 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Fix semicolon less macro-detection.

It was fooled by the comment.

Before:
SOME_UNRELATED_MACRO
/*static*/ int i;

After:
SOME_UNRELATED_MACRO
/*static*/ int i;

llvm-svn:

clang-format: Fix semicolon less macro-detection.

It was fooled by the comment.

Before:
SOME_UNRELATED_MACRO
/*static*/ int i;

After:
SOME_UNRELATED_MACRO
/*static*/ int i;

llvm-svn: 237246

show more ...


# a7b14260 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: [ObjC] Further improve wrapping of methods calls without inputs.

Before:
[aaaaaaaaaaaaaaaaaaaaaaa
.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa] aaaaaaaaaaaaaaaaaaaaaa];

After:
[aaaaaaaaa

clang-format: [ObjC] Further improve wrapping of methods calls without inputs.

Before:
[aaaaaaaaaaaaaaaaaaaaaaa
.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa] aaaaaaaaaaaaaaaaaaaaaa];

After:
[aaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa]
aaaaaaaaaaaaaaaaaaaaaa];

llvm-svn: 237244

show more ...


# a2a4d9c0 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: [ObjC] Make IndentWrappedFunctionNames work with ObjC functions

llvm-svn: 237241


# 0ad2814c 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Prefer formatting local lambdas like functions.

Before:
auto my_lambda =
[](const string &some_parameter) { return some_parameter.size(); };

After:
auto my_lambda = [](const

clang-format: Prefer formatting local lambdas like functions.

Before:
auto my_lambda =
[](const string &some_parameter) { return some_parameter.size(); };

After:
auto my_lambda = [](const string &some_parameter) {
return some_parameter.size();
};

llvm-svn: 237235

show more ...


# 60c27076 13-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Support column layout with comment after {.

Before:
vector<int> iiiiiiiiiiiiiii = { //
1111111111, 2222222222, 33333333333, 4444444444, //
111111111,

clang-format: Support column layout with comment after {.

Before:
vector<int> iiiiiiiiiiiiiii = { //
1111111111, 2222222222, 33333333333, 4444444444, //
111111111, 222222222, 3333333333, 444444444, //
11111111, 22222222, 333333333, 44444444};

After:
vector<int> iiiiiiiiiiiiiii = { //
1111111111, 2222222222, 33333333333, 4444444444, //
111111111, 222222222, 3333333333, 444444444, //
11111111, 22222222, 333333333, 44444444};

llvm-svn: 237233

show more ...


# 99b5a464 12-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Fix */& detection for lambdas in macros.

Before:
#define MACRO() [](A * a) { return 1; }

After:
#define MACRO() [](A *a) { return 1; }

llvm-svn: 237109


# 5fc133e7 12-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Fix hanging nested blocks in macros.

Before:
#define MACRO() \
Debug(aaa, /* force line break */ \
{ \
int i;

clang-format: Fix hanging nested blocks in macros.

Before:
#define MACRO() \
Debug(aaa, /* force line break */ \
{ \
int i; \
int j; \
})

After:
#define MACRO() \
Debug(aaa, /* force line break */ \
{ \
int i; \
int j; \
})

llvm-svn: 237108

show more ...


# 3d3ea84a 12-May-2015 Manuel Klimek <klimek@google.com>

Refactor clang-format's formatter.

Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
of the indent of levels across multiple annotated lines.
b) Put all respon

Refactor clang-format's formatter.

Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
of the indent of levels across multiple annotated lines.
b) Put all responsibility for merging lines into the LineJoiner; make the
LineJoiner iterate over the lines so we never operate on a line that might
be merged later; this makes the interface safer to use.
c) Move formatting of the end-of-file whitespace into formatFirstToken.

Fix bugs that became obvious after the refactoring:
1. We would not format lines with offsets correctly inside nested blocks if
only the outer expression was affected:
int x = s({ // clang-format only this line
class X {
public:
// ^ this starts at the non-modified indnent level; previously we would
// not fix this, now we correctly outdent it.
void f();
};
});
2. We would incorrectly align comments across lines that do not have comments
for lines with nested blocks:
int expression; // with comment
int x = s({
int y; // comment
int z; // we would incorrectly align this comment with the comment on
// 'expression'
});

llvm-svn: 237104

show more ...


Revision tags: llvmorg-3.6.1-rc1
# 015c7a91 11-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Support aligning ObjC string literals.

Before:
NSString s = @"aaaa"
@"bbbb";

After:
NSString s = @"aaaa"
@"bbbb";

llvm-svn: 237000


# d57843d4 11-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Improve column layout.

Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This auto

clang-format: Improve column layout.

Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.

Before:
vector<int> x = {1,
aaaaaaaaaaaaaaaaaaaaaa,
2,
bbbbbbbbbbbbbbbbbbbbbb,
3,
cccccccccccccccccccccc};

After:
vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa,
2, bbbbbbbbbbbbbbbbbbbbbb,
3, cccccccccccccccccccccc};

llvm-svn: 236992

show more ...


# 790d4f97 11-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Don't merge subsequent lines into _asm blocks.

Before:
_asm {
} int i;

After:
_asm {
}
int i;

llvm-svn: 236985


# 173504e4 10-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Improve wrapping of << operators.

Before:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaa

clang-format: Improve wrapping of << operators.

Before:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

Also, cleanup and simplify the operator wrapping logic.

llvm-svn: 236960

show more ...


# c6366077 10-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Preserve line break before } in __asm { ... }.

Some compilers ignore everything after a semicolon in such inline asm
blocks and thus, the closing brace must not be moved to the previou

clang-format: Preserve line break before } in __asm { ... }.

Some compilers ignore everything after a semicolon in such inline asm
blocks and thus, the closing brace must not be moved to the previous
line.

llvm-svn: 236946

show more ...


# f0fd1c66 10-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Fix bug in escaped newline calculation.

This prevents clang-format from inadvertently joining stuff into macro
definitions as reported in llvm.org/PR23466.

llvm-svn: 236944


# e4c16c7c 08-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Several improvements around formatting braced lists.

In particular:
* If the difference between the longest and shortest element, we copped
out of column format completely. Now, we i

clang-format: Several improvements around formatting braced lists.

In particular:
* If the difference between the longest and shortest element, we copped
out of column format completely. Now, we instead allow to arrange
these in a single column, essentially enforcing a one-per-line format.
* Allow column layout even if there are braced lists. Especially, if
there are many short lists, this can be beneficial. The bad case,
where there is a long nested init list is usually caught as we now
limit the length difference of the longest and shortest element.

llvm-svn: 236851

show more ...


# 9c95013e 07-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Improve r236597, Properly indent method calls without inputs.

Before:
[aaaaaaaaaaaa(aaaaaa)
aaaaaaaaaaaaaaaaaaaa];

After:
[aaaaaaaaaaaa(aaaaaa)
aaaaaaaaaaaaaaaaaaa

clang-format: Improve r236597, Properly indent method calls without inputs.

Before:
[aaaaaaaaaaaa(aaaaaa)
aaaaaaaaaaaaaaaaaaaa];

After:
[aaaaaaaaaaaa(aaaaaa)
aaaaaaaaaaaaaaaaaaaa];

llvm-svn: 236730

show more ...


# ec5c3db7 07-May-2015 Manuel Klimek <klimek@google.com>

Implements a way to retrieve information about whether some lines were not formatted due to syntax errors.

llvm-svn: 236722


1...<<31323334353637383940>>...82