History log of /llvm-project/clang/lib/Format/Format.cpp (Results 726 – 750 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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 ...


# dcd5da1f 20-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix formatting of nested blocks after comment.

Before:
DEBUG({ // Comment that used to confuse clang-format.
fdafas();
});
Before:
DEBUG({ // Comments are now fine.
fdafas(

clang-format: Fix formatting of nested blocks after comment.

Before:
DEBUG({ // Comment that used to confuse clang-format.
fdafas();
});
Before:
DEBUG({ // Comments are now fine.
fdafas();
});

This fixed llvm.org/PR17619.

llvm-svn: 193051

show more ...


# fbc057ea 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Be more aggressive on incorrect code.

Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has

clang-format: Be more aggressive on incorrect code.

Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has gotten good enough at parsing the code structure that
this hurts in almost all cases. Commonly, while writing code, it is
very useful to be able to correclty indent incomplete if statements or
for loops.

In case this leads to errors that we don't anticipate, we need to find
out and fix those.

This fixed llvm.org/PR17594.

llvm-svn: 192988

show more ...


# 6633ab8a 18-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Make continuation indent width configurable.

Patch by Kim Gräsman. Thank you!

llvm-svn: 192964


# e2e0387f 14-Oct-2013 Alexander Kornienko <alexfh@google.com>

Keep track of indentation levels in static initializers for correct indentation with tabs.

Summary:
Store IndentationLevel in ParentState and use it instead of the
Line::Level when indening.
Also fi

Keep track of indentation levels in static initializers for correct indentation with tabs.

Summary:
Store IndentationLevel in ParentState and use it instead of the
Line::Level when indening.
Also fixed incorrect indentation level calculation in formatFirstToken.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192563

show more ...


# fba84ff0 12-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: No space in "<::" in C++11 mode.

llvm-svn: 192524


# 71814b44 11-Oct-2013 Manuel Klimek <klimek@google.com>

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifde

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifdef A
MyType<Some> >
#else
Type1, Type2>
#endif
param2,
#endif
param3) {
f();
}

llvm-svn: 192503

show more ...


# 877615cc 11-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Don't remove 'unknown' tokens.

In certain macros or incorrect string literals, the token stream can
contain 'unknown' tokens, e.g. a single backslash or a set of empty
ticks. clang-for

clang-format: Don't remove 'unknown' tokens.

In certain macros or incorrect string literals, the token stream can
contain 'unknown' tokens, e.g. a single backslash or a set of empty
ticks. clang-format simply treated them as whitespace and removed them
prior to this patch.

This fixes llvm.org/PR17215

llvm-svn: 192490

show more ...


# 320997e6 06-Oct-2013 Daniel Jasper <djasper@google.com>

clang-format: Remove empty lines after visibility modifiers.

Formatting:
class C {
public:

f();
};

Now leads to:
class C {
public:
f();
};

llvm-svn: 192062


# d544aa79 30-Sep-2013 Edwin Vane <edwin.vane@intel.com>

Moving style option formatting to libFormat

The help text for clang-format's -style option and the function that processes
its value is moved to libFormat in this patch. The goal is to enable other

Moving style option formatting to libFormat

The help text for clang-format's -style option and the function that processes
its value is moved to libFormat in this patch. The goal is to enable other
tools that use libFormat and also have a -style option to behave consistently
with clang-format.

llvm-svn: 191666

show more ...


# 3c3d09c8 27-Sep-2013 Alexander Kornienko <alexfh@google.com>

Implemented tab usage only for indentation (http://llvm.org/PR17363)

Summary:
Changed UseTab to be a enum with three options: Never, Always,
ForIndentation (true/false are still supported when readi

Implemented tab usage only for indentation (http://llvm.org/PR17363)

Summary:
Changed UseTab to be a enum with three options: Never, Always,
ForIndentation (true/false are still supported when reading .clang-format).
IndentLevel should currently be propagated correctly for all tokens, except for
block comments. Please take a look at the general idea before I start dealing
with block comments.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 191527

show more ...


# d94bff37 25-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Option to removing the space before assignment operators.

Patch contributed by Aaron Wishnick. Thank you!

llvm-svn: 191375


# 81e3294e 16-Sep-2013 Alexander Kornienko <alexfh@google.com>

When in pre-c++11 mode, treat _T("xxx") as a single string literal, repeat the _T() part around each fragment. This addresses http://llvm.org/PR17122

Reviewers: djasper

Reviewed By: djasper

CC: cf

When in pre-c++11 mode, treat _T("xxx") as a single string literal, repeat the _T() part around each fragment. This addresses http://llvm.org/PR17122

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek, rsmith

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

llvm-svn: 190804

show more ...


# 015ed028 13-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix incorrect enum parsing / layouting.

Before:
enum {
Bar = Foo < int,
int > ::value
};

After:
enum {
Bar = Foo<int, int>::value
};

llvm-svn: 190674


# 9e649af0 11-Sep-2013 Alexander Kornienko <alexfh@google.com>

Support for CR LF newlines.

Summary:
reformat() tries to determine the newline style used in the input
(either LF or CR LF), and uses it for the output. Maybe not every single case is
supported, but

Support for CR LF newlines.

Summary:
reformat() tries to determine the newline style used in the input
(either LF or CR LF), and uses it for the output. Maybe not every single case is
supported, but at least the bug described in http://llvm.org/PR17182 should be
resolved.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190519

show more ...


# 917f9e04 10-Sep-2013 Alexander Kornienko <alexfh@google.com>

Correctly calculate OriginalColumn after multi-line tokens.

Summary: This also unifies the handling of escaped newlines for all tokens.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, kl

Correctly calculate OriginalColumn after multi-line tokens.

Summary: This also unifies the handling of escaped newlines for all tokens.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190405

show more ...


# 39856b71 10-Sep-2013 Alexander Kornienko <alexfh@google.com>

Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.

Summary:
This fixes various issues with mixed tabs and spaces handling, e.g.
when realigning block comments.

Reviewers: kl

Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.

Summary:
This fixes various issues with mixed tabs and spaces handling, e.g.
when realigning block comments.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits

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

llvm-svn: 190395

show more ...


# 9b246e09 08-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Keep empty lines and format 1-line nested blocks.

Let clang-format consistently keep up to one empty line (configured via
FormatStyle::MaxEmptyLinesToKeep) in nested blocks, e.g. lambd

clang-format: Keep empty lines and format 1-line nested blocks.

Let clang-format consistently keep up to one empty line (configured via
FormatStyle::MaxEmptyLinesToKeep) in nested blocks, e.g. lambdas. Also,
actually format single statements in nested blocks.

Before:
DEBUG({ int i; });
DEBUG({
int i;
// an empty line here would just be removed.
int j;
});

After:
DEBUG({ int i; });
DEBUG({
int i;

int j;
});

llvm-svn: 190278

show more ...


# 9ab4a77a 06-Sep-2013 Alexander Kornienko <alexfh@google.com>

Don't remove trailing escaped newline from line comments.

llvm-svn: 190175


# 36c28ce3 06-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix regression introduced by r189353.

Before:
FirstToken->WhitespaceRange.getBegin()
.getLocWithOffset(First->LastNewlineOffset);

After:
FirstToken->WhitespaceRange.getBegin

clang-format: Fix regression introduced by r189353.

Before:
FirstToken->WhitespaceRange.getBegin()
.getLocWithOffset(First->LastNewlineOffset);

After:
FirstToken->WhitespaceRange.getBegin().getLocWithOffset(
First->LastNewlineOffset);

Re-add logic to prevent breaking after an empty set of parentheses.
Basically it seems that calling a function without parameters is more
like navigating along the same object than it is a separate step of a
builder-type call.

We might need to extends this in future to allow "short" parameters that
e.g. are an index accessing a specific element.

llvm-svn: 190126

show more ...


# 1c5d9df8 06-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix comment formatting bugs in nested blocks.

This fixes two issues:
1) The indent of a line comment was not adapted to the subsequent
statement as it would be outside of a nested b

clang-format: Fix comment formatting bugs in nested blocks.

This fixes two issues:
1) The indent of a line comment was not adapted to the subsequent
statement as it would be outside of a nested block.
2) A missing DryRun flag caused actualy breaks to be inserted in
overly long comments while trying to come up with the best line
breaking decisions.

llvm-svn: 190123

show more ...


# ebb43caa 05-Sep-2013 Alexander Kornienko <alexfh@google.com>

Handle zero-width and double-width characters in string literals and comments.

Summary:
Count column width instead of the number of code points. This also
includes correct handling of tabs inside st

Handle zero-width and double-width characters in string literals and comments.

Summary:
Count column width instead of the number of code points. This also
includes correct handling of tabs inside string literals and comments (with an
exception of multiline string literals/comments, where tabs are present before
the first escaped newline).

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 190052

show more ...


# f3a5d004 05-Sep-2013 Daniel Jasper <djasper@google.com>

Address post-commit review comments from r190038.

Mostly additional comments :-).

llvm-svn: 190042


# 9fe0e8da 05-Sep-2013 Daniel Jasper <djasper@google.com>

clang-format: Enable formatting of nested blocks.

Among other things, this enables (better) formatting lambdas and
constructs like:
MACRO({
long_statement();
long_statement_2()

clang-format: Enable formatting of nested blocks.

Among other things, this enables (better) formatting lambdas and
constructs like:
MACRO({
long_statement();
long_statement_2();
},
{
long_statement();
long_statement_2();
},
{ short_statement(); }, "");

This fixes llvm.org/PR15381.

llvm-svn: 190038

show more ...


# b40cfe48 04-Sep-2013 Alexander Kornienko <alexfh@google.com>

Handle 'Cpp03' and 'Cpp11' strings in LanguageStandard serialization for
consistency of serialized form with the actual enum member names without
a prefix.

llvm-svn: 189936


1...<<21222324252627282930>>...47