History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 1376 – 1400 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3abbb8a4 12-Nov-2013 Alexander Kornienko <alexfh@google.com>

Do not insert backslashes, when breaking line comments after preprocessor directives.

Summary: This solves http://llvm.org/PR17536

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits,

Do not insert backslashes, when breaking line comments after preprocessor directives.

Summary: This solves http://llvm.org/PR17536

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 194491

show more ...


# 27943058 09-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix alignment of ObjC string literals.

This used to interfere with AlwaysBreakBeforeMultilineStrings.

This fixes llvm.org/PR17856.

llvm-svn: 194310


# 0e93cdb0 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve clang-format's detection about comment binding.

Before, existing code in the form of:

int a; // this is a.
// This is
// b.
int b;

Got turned into:

int a; // this

clang-format: Improve clang-format's detection about comment binding.

Before, existing code in the form of:

int a; // this is a.
// This is
// b.
int b;

Got turned into:

int a; // this is a.
// This is
// b.
int b;

llvm-svn: 194294

show more ...


# 9e5ede0f 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve formatting of operators forced to new lines.

Before:
unsigned ContentSize =
sizeof(int16_t) // DWARF ARange version number
+
sizeof(int32_t) // Offset of CU

clang-format: Improve formatting of operators forced to new lines.

Before:
unsigned ContentSize =
sizeof(int16_t) // DWARF ARange version number
+
sizeof(int32_t) // Offset of CU in the .debug_info section
+
sizeof(int8_t) // Pointer Size (in bytes)
+
sizeof(int8_t); // Segment Size (in bytes)

After:
unsigned ContentSize =
sizeof(int16_t) // DWARF ARange version number
+ sizeof(int32_t) // Offset of CU in the .debug_info section
+ sizeof(int8_t) // Pointer Size (in bytes)
+ sizeof(int8_t); // Segment Size (in bytes)

This fixes llvm.org/PR17687.

llvm-svn: 194276

show more ...


# 98fb6e1b 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Don't auto-break short macros in WebKit style.

This fixes llvm.org/PR17842.

llvm-svn: 194268


# 4478e524 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve linebreaking and indentation for ObjC calls.

Before:
popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
iniithContentRect:
NSMakRet(origin_global.x, origin_gl

clang-format: Improve linebreaking and indentation for ObjC calls.

Before:
popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
iniithContentRect:
NSMakRet(origin_global.x, origin_global.y, pos.width(), pos.height())
syeMask:NSBorderlessWindowMask
bking:NSBackingStoreBuffered
der:NO]);
[self param:function( //
parameter)]

After:
popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
iniithContentRect:NSMakRet(origin_global.x, origin_global.y, pos.width(),
pos.height())
syeMask:NSBorderlessWindowMask
bking:NSBackingStoreBuffered
der:NO]);
[self param:function( //
parameter)]

llvm-svn: 194267

show more ...


# b302f9a0 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Properly indent ObjC calls wrapped before first selector

Before:
[self // break
a:a
aa:aa
aaaaa:aaa];

After:
[self // break
a:a
aa:aa
aaaaa:a

clang-format: Properly indent ObjC calls wrapped before first selector

Before:
[self // break
a:a
aa:aa
aaaaa:aaa];

After:
[self // break
a:a
aa:aa
aaaaa:aaa];

llvm-svn: 194241

show more ...


# 165b29e2 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Make breaking before ternary operators configurable.

llvm-svn: 194229


# a98da3d2 07-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve binary operator detection in macros.

Before:
#define M(NAME) assert(!Context.Verifying &&#NAME);

After:
#define M(NAME) assert(!Context.Verifying && #NAME);

This fixes ll

clang-format: Improve binary operator detection in macros.

Before:
#define M(NAME) assert(!Context.Verifying &&#NAME);

After:
#define M(NAME) assert(!Context.Verifying && #NAME);

This fixes llvm.org/PR16156.

llvm-svn: 194216

show more ...


# f48b5abc 07-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve ObjC variadic and binary expression parameters.

Before:
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa

clang-format: Improve ObjC variadic and binary expression parameters.

Before:
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

After:
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

This addresses llvm.org/PR15349 and llvm.org/PR16185.

llvm-svn: 194214

show more ...


# 4fcc8b91 07-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve formatting of constructor initializers.

Before:
Constructor()
: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa,

clang-format: Improve formatting of constructor initializers.

Before:
Constructor()
: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa,
aaaa)) {}
After:
Constructor()
: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa, aaaa)) {}

llvm-svn: 194210

show more ...


# bc5cb4e3 07-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Remove old hack that mainly made incorrect tests pass.

As a side-effect, constructors definitions will correctly be recognized
and formatted as function declarations. Tests will be add

clang-format: Remove old hack that mainly made incorrect tests pass.

As a side-effect, constructors definitions will correctly be recognized
and formatted as function declarations. Tests will be added in a
follow-up patch actually using the correct recognition.

llvm-svn: 194209

show more ...


# 6b6e7c37 07-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix corner case for brace alignment.

Before:
Constructor::Constructor()
: some_value{ //
aaaaaaa //
} {}

After:
Constructor::Constructor()
: some_value{

clang-format: Fix corner case for brace alignment.

Before:
Constructor::Constructor()
: some_value{ //
aaaaaaa //
} {}

After:
Constructor::Constructor()
: some_value{ //
aaaaaaa //
} {}

llvm-svn: 194204

show more ...


# bbf5c1c9 05-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Allow line merging and partial formatting of nested blocks

Before, clang-format would always format entire nested blocks, which
can be unwanted e.g. for long DEBUG({...}) statements. A

clang-format: Allow line merging and partial formatting of nested blocks

Before, clang-format would always format entire nested blocks, which
can be unwanted e.g. for long DEBUG({...}) statements. Also
clang-format would not allow to merge lines in nested blocks (e.g. to
put "if (a) return;" on one line in Google style).

This is the first step of several refactorings mostly focussing on the
additional functionality (by reusing the "format many lines" code to
format the children of a nested block). The next steps are:
* Pull out the line merging into its own class.
* Seperate the formatting of many lines from the formatting of a single
line (and the analysis of the solution space).

llvm-svn: 194090

show more ...


# 16fc7542 30-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix indenting corner case with comment and else.

Before:
if (a) {
f();
}
// or else ..
else {
g();
}

After:
if (a) {
f();
}
// or else ..
else {

clang-format: Fix indenting corner case with comment and else.

Before:
if (a) {
f();
}
// or else ..
else {
g();
}

After:
if (a) {
f();
}
// or else ..
else {
g();
}

llvm-svn: 193684

show more ...


# 9885784d 30-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix whitespaces in include directives.

Before (clang-format wouldn't change):
#include "a.h"
#include<a>

After:
#include "a.h"
#include <a>

This fixes llvm.org/PR16151.

llv

clang-format: Fix whitespaces in include directives.

Before (clang-format wouldn't change):
#include "a.h"
#include<a>

After:
#include "a.h"
#include <a>

This fixes llvm.org/PR16151.

llvm-svn: 193683

show more ...


# 580da276 30-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: fix for \r\r\n produced in multiline block comments

Patch by Christopher Olsen. Thank you!

llvm-svn: 193678


# dd978ae0 29-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Option to control spacing in template argument lists.

Same as SpacesInParentheses, this option allows adding a space inside
the '<' and '>' of a template parameter list.

Patch by Chri

clang-format: Option to control spacing in template argument lists.

Same as SpacesInParentheses, this option allows adding a space inside
the '<' and '>' of a template parameter list.

Patch by Christopher Olsen.

This fixes llvm.org/PR17301.

llvm-svn: 193614

show more ...


# edc5f091 29-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix overloaded operator for global-scoped conversions.

Before:
operator::A();

After:
operator ::A();

llvm-svn: 193605


# a1ea4cbb 26-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix ObjC method exprs with variadic parameters.

Before:
_versionLabel.text = [
NSString stringWithFormat:NSLocalizedString(@"version: %@", @"Label"),
[NSBundle mainBundle].in

clang-format: Fix ObjC method exprs with variadic parameters.

Before:
_versionLabel.text = [
NSString stringWithFormat:NSLocalizedString(@"version: %@", @"Label"),
[NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]
];

After:
_versionLabel.text =
[NSString stringWithFormat:NSLocalizedString(@"version: %@", @"Label"),
[NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]];

This fixed llvm.org/PR17695.

llvm-svn: 193475

show more ...


# 33b909c5 25-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Adapt line break penalties for LLVM style.

Specifically make clang-format less eager to break after the opening
parenthesis of a function call.

Before:
aaaaaaaaaaaaaaaaa(
aaaa

clang-format: Adapt line break penalties for LLVM style.

Specifically make clang-format less eager to break after the opening
parenthesis of a function call.

Before:
aaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

Apparently that is preferable. This penalties are adapted
conservatively, we might have to increase them a little bit further.

llvm-svn: 193410

show more ...


# 472da864 24-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Properly reset nested AnnotatedLine structure.

This fixes llvm.org/PR17682.

Without this patch, the following code leads to invalid reads/writes:
DEBUG({
return aaaaaaaaaaaaaaaa

clang-format: Properly reset nested AnnotatedLine structure.

This fixes llvm.org/PR17682.

Without this patch, the following code leads to invalid reads/writes:
DEBUG({
return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
});
#if a
#else
#endif

Because of the #if-#else structure, the code is formatted and annotated
twice and becauce of the nested block, the annotated lines form a
hierarchical structure. This structure was not properly reset between
runs.

llvm-svn: 193352

show more ...


# 7c72d9fe 24-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Be more conservative about column layout formatting.

Specifically, if a braced list has at least one nested braced list,
format it either all on one line or in one column (i.e. one ite

clang-format: Be more conservative about column layout formatting.

Specifically, if a braced list has at least one nested braced list,
format it either all on one line or in one column (i.e. one item per
line).

This seems in general to be an improvement as the structure of nested
braced lists can make a tightly packed outer braced list hard to read.

llvm-svn: 193345

show more ...


# b596fb2b 24-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Cleanup array initializer and dict initializer formatting.

Significant changes:
- Also recognize these literals with missing "@" for robustness.
- Reorganize tests.

llvm-svn: 193325


# b8f61682 22-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix ObjC literal indentation in Google style.

Style guide demands a two-space indent.

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

clang-format: Fix ObjC literal indentation in Google style.

Style guide demands a two-space indent.

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"
];

llvm-svn: 193168

show more ...


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