History log of /llvm-project/clang/lib/Format/Format.cpp (Results 1026 – 1050 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c36492b5 16-Jan-2013 Daniel Jasper <djasper@google.com>

Remove errors were if statements were incorrectly put on a single line.

Before: if (a) // This comment confused clang-format f();
After: if (a) // No more confusion
f();
llvm-svn: 172600


# a31e58b2 15-Jan-2013 Manuel Klimek <klimek@google.com>

Do not traverse the break-state when we know we cannot break anyway.

This is an optimization that djasper spottet. For now, we do not format
anything after the first token that belongs to such an im

Do not traverse the break-state when we know we cannot break anyway.

This is an optimization that djasper spottet. For now, we do not format
anything after the first token that belongs to such an implicit string
literal. All our state is not made for handling that anyway, so we'll
revisit this if we find a problem.

llvm-svn: 172537

show more ...


# 99c7baa3 15-Jan-2013 Manuel Klimek <klimek@google.com>

Fix formatting of preprocessor directives (incluces, warnings & errors).

Treat tokens inside <> for includes and everything from the second token
of a warning / error on as an implicit string litera

Fix formatting of preprocessor directives (incluces, warnings & errors).

Treat tokens inside <> for includes and everything from the second token
of a warning / error on as an implicit string literal, e.g. do not
change its whitespace at all.

Now correctly formats:
#include < path with space >
#error Leave all white!!!!! space* alone!

Note that for #error and #warning we still format the space up to the
first token of the text, so:
# error Text
will become
#error Text

llvm-svn: 172536

show more ...


# 7194527d 15-Jan-2013 Daniel Jasper <djasper@google.com>

Improve operator kind detection in presence of comments.

We used to incorrectly identify some operators (*, &, +, -, etc.) if
there were comments around them.

Example:
Before: int a = /**/ - 1;
Aft

Improve operator kind detection in presence of comments.

We used to incorrectly identify some operators (*, &, +, -, etc.) if
there were comments around them.

Example:
Before: int a = /**/ - 1;
After: int a = /**/ -1;

llvm-svn: 172533

show more ...


# a54d1a99 14-Jan-2013 Manuel Klimek <klimek@google.com>

Fixes formatting of nested brace initializers.

We now format this correctly:
Status::Rep Status::global_reps[3] = {
{ kGlobalRef, OK_CODE, NULL, NULL, NULL },
{ kGlobalRef, CANCELLED_CODE, NULL,

Fixes formatting of nested brace initializers.

We now format this correctly:
Status::Rep Status::global_reps[3] = {
{ kGlobalRef, OK_CODE, NULL, NULL, NULL },
{ kGlobalRef, CANCELLED_CODE, NULL, NULL, NULL },
{ kGlobalRef, UNKNOWN_CODE, NULL, NULL, NULL }
};

- fixed a bug where BreakBeforeClosingBrace would be set on the wrong
state
- added penalties for breaking between = and {, and between { and any
other non-{ token

llvm-svn: 172433

show more ...


# 1b750edd 14-Jan-2013 Daniel Jasper <djasper@google.com>

Make single-line if statements optional.

Now, "if (a) return;" is only allowed, if this option is set.

Also add a Chromium style which is currently identical to Google style
except for this option.

Make single-line if statements optional.

Now, "if (a) return;" is only allowed, if this option is set.

Also add a Chromium style which is currently identical to Google style
except for this option.

llvm-svn: 172431

show more ...


# 3e9218e5 14-Jan-2013 Daniel Jasper <djasper@google.com>

Fix a bug in the line merging.

If the first line of a merge would exactly fit into the column limit,
an unsigned overflow made us not break.

llvm-svn: 172426


# 2ab0d01a 14-Jan-2013 Daniel Jasper <djasper@google.com>

Fix bug that would lead to joining preprocessor directives.

Before: #include "a.h" #include "b.h"
After: #include "a.h"
#include "b.h"
llvm-svn: 172424


# 39825eaf 14-Jan-2013 Daniel Jasper <djasper@google.com>

Put simple preprocessor directives on a single line.

Before: #define A \
A
After: #define A A
llvm-svn: 172423


# 25837aa6 14-Jan-2013 Daniel Jasper <djasper@google.com>

Put short if statements on a single line.

Before: if (a)
return;
After: if (a) return;

Not yet sure, whether this is always desired, but we can add options and
make this a style paramete

Put short if statements on a single line.

Before: if (a)
return;
After: if (a) return;

Not yet sure, whether this is always desired, but we can add options and
make this a style parameter as we go along.

llvm-svn: 172413

show more ...


# f1e4b7d7 14-Jan-2013 Daniel Jasper <djasper@google.com>

Refactor datastructure used in clang-format.

Main difference, add an AnnotatedLine class to hold information about a
line while formatting. At the same time degrade the UnwrappedLine class
to a clas

Refactor datastructure used in clang-format.

Main difference, add an AnnotatedLine class to hold information about a
line while formatting. At the same time degrade the UnwrappedLine class
to a class solely used for communicating between the UnwrappedLineParser
and the Formatter.

No functional changes intended.

llvm-svn: 172403

show more ...


# 13f23e17 14-Jan-2013 Daniel Jasper <djasper@google.com>

Improve understanding post increment and decrement.

Before: (a->f()) ++;
a[42] ++;
After: (a->f())++;
a[42]++;
llvm-svn: 172400


# 116ba682 14-Jan-2013 Alexander Kornienko <alexfh@google.com>

Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.

Summary:
Added tests for clang-format diagnostics. Added DiagnosticConsumer
argument to clang::format::reformat

Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.

Summary:
Added tests for clang-format diagnostics. Added DiagnosticConsumer
argument to clang::format::reformat().

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, thakis, rafael.espindola

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

llvm-svn: 172399

show more ...


# 942ee72a 13-Jan-2013 Daniel Jasper <djasper@google.com>

Stronger respect the input codes line breaks wrt. comments.

clang-format should not change whether or not there is a line break
before a line comment as this strongly influences the percieved bindin

Stronger respect the input codes line breaks wrt. comments.

clang-format should not change whether or not there is a line break
before a line comment as this strongly influences the percieved binding.

User input: void f(int a,
// b is awesome
int b);
void g(int a, // a is awesome
int b);
Before: void f(int a, // b is awesome
int b);
void g(int a, // a is awesome
int b);
After: <unchanged from input>

llvm-svn: 172361

show more ...


# 48cb3b97 13-Jan-2013 Daniel Jasper <djasper@google.com>

Always put a space after ",".

I am not aware of a case where that would be wrong. The specific case I
am fixing are function parameters wrapped in parenthesis (e.g. in
macros).

Before: function(a,(

Always put a space after ",".

I am not aware of a case where that would be wrong. The specific case I
am fixing are function parameters wrapped in parenthesis (e.g. in
macros).

Before: function(a,(b));
After: function(a, (b));
llvm-svn: 172351

show more ...


# 5ef433fc 13-Jan-2013 Daniel Jasper <djasper@google.com>

Don't put spaces around hyphens in include paths.

Before: #include <a - a>
After: #include <a-a>
llvm-svn: 172350


# ef906a9c 13-Jan-2013 Daniel Jasper <djasper@google.com>

Improve identification of c-style casts.

A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues
with the formatting of unnamed parameters.

Before: void f(int *){}
After: void f(int

Improve identification of c-style casts.

A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues
with the formatting of unnamed parameters.

Before: void f(int *){}
After: void f(int *) {}
llvm-svn: 172349

show more ...


# 2827a7ec 12-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Don't insert a space before unary operators after selector names.

Before:
[color getRed: &r green: &g blue: &b alpha: &a];

Now:
[color getRed:&r green:&g blue:&b alpha:&a];

llvm-svn

Formatter: Don't insert a space before unary operators after selector names.

Before:
[color getRed: &r green: &g blue: &b alpha: &a];

Now:
[color getRed:&r green:&g blue:&b alpha:&a];

llvm-svn: 172337

show more ...


# 92c05391 12-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Remove debugging junk I accidentally landed in r172333.

llvm-svn: 172334


# c9d73611 12-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Prefer breaking before ObjC selector names over breaking at their ':'

Before:
if ((self = [super initWithContentRect:contentRect styleMask:
styleMask backing:NSBacking

Formatter: Prefer breaking before ObjC selector names over breaking at their ':'

Before:
if ((self = [super initWithContentRect:contentRect styleMask:
styleMask backing:NSBackingStoreBuffered defer:YES])) {

Now:
if ((self = [super initWithContentRect:contentRect styleMask:styleMask
backing:NSBackingStoreBuffered defer:YES])) {

llvm-svn: 172333

show more ...


# f857950d 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com>

Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323


# 8f1187a1 12-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com>

Remove unused private field.

llvm-svn: 172314


# 7b7877ad 12-Jan-2013 Daniel Jasper <djasper@google.com>

Fix incorrect comparison operator causing loooong formatting times.

llvm-svn: 172308


# cb465dcb 12-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Remove an always-false condition.

canBreakBefore() does not allow breaking after ':' for LT_ObjCMethodDecl lines,
so if Newline is true in addTokenToState() for ':' then LT_ObjCMethodDecl

Formatter: Remove an always-false condition.

canBreakBefore() does not allow breaking after ':' for LT_ObjCMethodDecl lines,
so if Newline is true in addTokenToState() for ':' then LT_ObjCMethodDecl
cannot be set. No functionality change.

llvm-svn: 172307

show more ...


# c7a56342 12-Jan-2013 Nico Weber <nicolasweber@gmx.de>

Formatter: Remove a redundant CurrentLineType check.

The containing if checks for this already. No functionality change.

llvm-svn: 172306


1...<<41424344454647