History log of /external/clang/lib/Format/UnwrappedLineParser.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
516fb31d0536040334032e2af6b62cd6a5479d1c 01-Mar-2013 Daniel Jasper <djasper@google.com> Remove whitespace at end of file.

This fixes the rest of llvm.org/PR15062.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
89a0daa0ec1fbc43489e3bb9e9648c816258f00f 12-Feb-2013 Daniel Jasper <djasper@google.com> Fix crash for incomplete labels in macros.

Still the formatting can be improved, but at least we don't assert any
more. This happened when trying to format lib/Sema/SemaType.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
3f4535e44965f46cf603146141d2d27a1cef1f7f 11-Feb-2013 Manuel Klimek <klimek@google.com> Get rid of manual debug output, now that the test runner supports it.

You can run tests with -debug instead now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a28fc067e3ee8eb84368530e878ce094f39651d3 11-Feb-2013 Manuel Klimek <klimek@google.com> Fixes handling of empty lines in macros.

Now correctly formats:
#define A \
\
b;
to
#define A b;

Added the state whether an unwrapped line is a macro to the debug
output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d74fcdb630dad817f5d462edd6d12bb95e3f27f1 10-Feb-2013 Nico Weber <nicolasweber@gmx.de> Formatter: Initial support for ObjC dictionary literals.

Before:
@{
foo:
bar
}
;

Now:
@{ foo : bar };

parseBracedList() already does the right thing from an UnwrappedLineParser
perspective, so check for "@{" in all loops that process constructs that can
contain expressions and call parseBracedList() if found.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
2afbe523648eb591709ac9262f024457eb019bd6 10-Feb-2013 Nico Weber <nicolasweber@gmx.de> Reformat formatter code. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
b3507cd01ead99113eed92a815b826f26f6dbadb 06-Feb-2013 Manuel Klimek <klimek@google.com> Fix handling of comments in macros.

We now correctly format:
// Written as a macro, it is reformatted from:
#define foo(a) \
do { \
/* Initialize num to zero. */ \
int num = 10; \
/* This line ensures a is never zero. */ \
int i = a == 0 ? 1 : a; \
i = num / i; /* This division is OK. */ \
return i; \
} while (false)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
7fc2db0acd3fb0f38db19764eef137ae3a9edc9f 06-Feb-2013 Manuel Klimek <klimek@google.com> Much semicolon after namespaces.

We now leave the semicolon in the line of the closing brace in:
namespace {
...
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
b8b1ce12362860e55590c55fd43db875c9193357 06-Feb-2013 Manuel Klimek <klimek@google.com> Parse record declarations with token pasted identifiers.

This is pretty common in macros:
#define A(X, Y) class X##Y {};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
bd04f2aa2247f2fda3fd8f3fee90479ba2c94499 31-Jan-2013 Manuel Klimek <klimek@google.com> Never break inside something that was a preprocessor directive.

Just put it in one unwrapped line and let the formatter handle it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
32d28ee6061930b2a9c170cbaaeea028c88a7b89 29-Jan-2013 Daniel Jasper <djasper@google.com> Move the token annotator into separate files.

No functional changes. Also removed experimental-warning from all of
clang-format's files, as it is no longer accurate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
7ccbc2156bfe473f080b585130d70e51c4b62bb0 23-Jan-2013 Manuel Klimek <klimek@google.com> Fix handling of macro definitions.

Now correctly formats:
#define A (1)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a32a7fda316289dca6aac1352fde3caf14a1cb2f 23-Jan-2013 Manuel Klimek <klimek@google.com> Fixes layouting regression and invalid-read.

Layouting would prevent breaking before + in
a[b + c] = d;
Regression detected by code review.

Also fixes an invalid-read found by the valgrind bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
836b58f564e07e806d3d0b41a193fde0921013c7 23-Jan-2013 Manuel Klimek <klimek@google.com> Fixes incorrect handling of the declaration context stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
70b03f4edaefcc5b9aa2e084d1c12e9d91b32a77 23-Jan-2013 Manuel Klimek <klimek@google.com> Allow us to better guess the context of an unwrapped line.

This gives us the ability to guess better defaults for whether a *
between identifiers is a pointer dereference or binary operator.

Now correctly formats:
void f(a *b);
void f() { f(a * b); }

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
86721d2a4610ac0a4b162952ec409df1fe397d58 22-Jan-2013 Manuel Klimek <klimek@google.com> Implements more principled comment parsing.

Changing nextToken() in the UnwrappedLineParser to get the next
non-comment token. This allows us to correctly layout a whole class of
snippets, like:

if /* */(/* */ a /* */) /* */
f() /* */; /* */
else /* */
g();

Fixes a bug in the formatter where we would assume there is a previous
non-comment token.
Also adds the indent level of an unwrapped line to the debug output in
the parser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
308232c0aef773d24693f9e456dc3bc983934f7f 21-Jan-2013 Manuel Klimek <klimek@google.com> Fixes various problems around enum parsing.

Very similar to what we do for record definitions:
- tighten down what is an enum definition, so that we don't mistake a
function for an enum
- allow common idioms around declarations (we'll want to handle that
more centrally in the future)

We now correctly format:
enum X f() {
a();
return 42;
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
2f1ac41a6d8d202dcc39ab8eb56ccea823dc062e 21-Jan-2013 Manuel Klimek <klimek@google.com> Fixes formatting of empty blocks.

We now only put empty blocks into a single line, if all of:
- all tokens of the structural element fit into a single line
- we're not in a control flow statement

Note that we usually don't put record definitions into a single line, as
there's usually at least one more token (the semicolon) after the
closing brace. This doesn't hold when we are in a context where there is
no semicolon, like "enum E {}".

There were some missing tests around joining lines around the corner
cases of the allowed number of columns, so this patch adds some.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d19dc2ddf3f8630cfdbefec490c0000c14bee6bd 21-Jan-2013 Manuel Klimek <klimek@google.com> Fixes indent in linkage specification blocks.

We now indent:
extern "C" {
int a;
}

without additional indent inside the extern "C" block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
3a3408cceb438af7cdebb5b3d938abb916162bb4 21-Jan-2013 Manuel Klimek <klimek@google.com> Fixes detection of class template specializations.

Now correctly formats:
template <> class A<int> {} a;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
7f5b025e9b9a981a257d83063064ac6e58239d76 21-Jan-2013 Manuel Klimek <klimek@google.com> Allow for nested name specifiers in record declarations.

Now correctly formats:
class A::B {} n;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
c44ee89cb448e34aada006b707eb45a1280f31e3 21-Jan-2013 Manuel Klimek <klimek@google.com> Fix parsing of return statements.

Previously, we would not detect brace initializer lists in return
statements, thus:
return (a)(b) { 1, 2, 3 };
would put the semicolon onto the next line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
b1ba0efc3d1dc1daa5d82c40bc504e1f368c4fa0 19-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Re-sort all the headers. Lots of regressions have crept in here.
Manually fix the order of UnwrappedLineParser.cpp as that one didn't
have its associated header as the first header.

This also uncovered a subtle inclusion order dependency as CLog.h didn't
include LLVM.h to pick up using declarations it relied upon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
525fe168c25a8273899281c5d2326c722fc3f2a5 18-Jan-2013 Manuel Klimek <klimek@google.com> Fixes problems with line merging in the face of preprocessor directives.

This patch prepares being able to test for and fix more problems (see
FIXME in the test for example).

Previously we would output unwrapped lines for preprocessor directives
at the point where we also parsed the hash token. Since often
projections only terminate (and thus output their own unwrapped line)
after peeking at the next token, this would lead to the formatter seeing
the preprocessor directives out-of-order (slightly earlier). To be able
to correctly identify lines to merge, the formatter needs a well-defined
order of unwrapped lines, which this patch introduces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
94fb72932c806c549f5c51f4bfa99fa7b481324a 18-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: After case blocks, "break" goes on the same line as the "}", PR14907.

Before:
switch (foo) {
case a: {
int a = g();
h(a);
}
break;
}

Now:
switch (foo) {
case a: {
int a = g();
h(a);
} break;
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
ca547dbbb1e10c801158f2eecaf3d49e1071b0e3 16-Jan-2013 Manuel Klimek <klimek@google.com> Add debugging support for split penalties.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
8fa37999164844a926448ef4656bbf7c42070235 16-Jan-2013 Manuel Klimek <klimek@google.com> Use standard llvm Debug.h support for debugging output.

Leave a quick "// Uncomment this." hint to enable the debug output in
tests. FIXME: figure out whether we want to enable debug command line
handling for all tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d881875b6c78386c4f0da911c1110f9ed1235c6a 16-Jan-2013 Alexander Kornienko <alexfh@google.com> Clang Format: Handle missing semicolon

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
cbb6c41f3cec4a940201a8e2e65743c9f26c3673 16-Jan-2013 Daniel Jasper <djasper@google.com> Change the datastructure for UnwrappedLines.

It was quite convoluted leading to us accidentally introducing O(N^2)
complexity while copying from UnwrappedLine to AnnotatedLine. We might
still want to improve the datastructure in AnnotatedLine (most
importantly not put them in a vector where they need to be copied on
vector resizing but that will be done as a follow-up.

This fixes most of the regression in llvm.org/PR14959.

No formatting changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
47ea7f64108163491ed74dc746c8d94e10764704 15-Jan-2013 Manuel Klimek <klimek@google.com> Fixes various bugs around the keywords class, struct and union.

This switches to parsing record definitions only if we can clearly
identify them. We're specifically allowing common patterns for
visibility control through macros and attributes, but we cannot
currently fix all instances. This fixes all known bugs we have though.

Before:
static class A f() {
return g();
} int x;

After:
static class A f() {
return g();
}
int x;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
1774603d8b34f86bd254d85a125592fcb323a488 13-Jan-2013 Daniel Jasper <djasper@google.com> Format unions like structs and classes.

Note that I don't know whether we should put {} on a single line in this
case, but it is probably a theoretical issue as in practice such
structs, classes or unions won't be empty.

Before: union A {}
a;
After: union A {} a;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
6eca03fcac1e408470d48e6309a280d3681f717d 11-Jan-2013 Manuel Klimek <klimek@google.com> Fix crashes in UnwrappedLineParser on missing parens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d465843f5376c7c1574fe61338cbf3dc50684d5b 11-Jan-2013 Manuel Klimek <klimek@google.com> Fix crash on invalid.

if { foo; }
would previously crash clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
606e07ecc0b7b0e01d23baa833b4b4c73af0d4f4 11-Jan-2013 Manuel Klimek <klimek@google.com> Fix parsing of initializer lists with elaborated type specifier.

Now we correctly parse and format:
verifyFormat("struct foo a = { bar };
int n;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
276a209451b8724807f2741f49c90bf27fc280c7 11-Jan-2013 Alexander Kornienko <alexfh@google.com> clang-format: a bit nicer error message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
3048aeae0654b34dcae561494c1b28872c88a5c8 10-Jan-2013 Alexander Kornienko <alexfh@google.com> Basic support for diagnostics.

Summary: Uses DiagnosticsEngine to output diagnostics.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
36fab8d70eee342d66e03c9b09c029f126196103 10-Jan-2013 Manuel Klimek <klimek@google.com> Do not add newline in empty blocks.

void f() {}
now gets formatted in one line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
bb42bf1a8bfd18fa2beec7fcbcb73f738fb455ba 10-Jan-2013 Manuel Klimek <klimek@google.com> Fix layout of blocks inside statements.

Previously, we would not indent:
SOME_MACRO({
int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.

Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
4c60fc6cb9928fe03b6b4794260edb779b2c44e1 10-Jan-2013 Manuel Klimek <klimek@google.com> Introduce a define to switch on debug output.

After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172050 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
b530fa374a8d4d96e61bf1dae8f4a73f4b3d2436 10-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: @optional and @required go on their own line.

Previously:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional - (void) optional;
@required - (void) required;
@end

Now:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional
- (void)optional;
@required
- (void)required;
@end



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
50767d8c8f2f667255bdb99692c0467ce992bc67 10-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: Add support for @implementation.

Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
049c44767370b7257d17a5c32d407f19efa01c6f 09-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: Make parseObjCUntilAtEnd() actually work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
1abe6ea5b8961a0fc14c2e0bdbd7451f643ca065 09-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatting: Add support for @protocol.

Pull pieces of the @interface code into reusable methods.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
27d1367871a6eab347346497e87ea1adb2fd15a5 09-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: Add support for @interface.

Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
526ed11ad9743c773df76bd1649d33fb92c2b8cb 09-Jan-2013 Manuel Klimek <klimek@google.com> Enables layouting unwrapped lines around preprocessor directives.

Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
withSomeParameters, whichInSequence,
areLongerThanALine(andAnotherCall,
B
withMoreParamters,
whichStronglyInfluenceTheLayout),
andMoreParameters),
trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
26f7e78018ed6ce8aa11b5eef94c772ca4ee48bf 08-Jan-2013 Daniel Jasper <djasper@google.com> Change the data structure used in clang-format.

This is a first step towards supporting more complex structures such
as #ifs inside unwrapped lines. This patch mostly converts the array-based
UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will
allow multiple children for each Token turning the UnwrappedLine into a
tree.

No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
6092d4ed09a2368871993d9a45717f24394329ce 07-Jan-2013 Nico Weber <nicolasweber@gmx.de> Formatter: Support @public/@protected/@package/@private.

@package is an Objective-C 2 feature, so turn on ObjC2 as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
de7685487c5d628dd9fe64c4f861cd1888f50fc7 07-Jan-2013 Manuel Klimek <klimek@google.com> Fix parsing of variable declarations directly after a class / struct.

Previous indent:
class A {
}
a;
void f() {
};

With this patch:
class A {
} a;
void f() {
}
;

The patch introduces a production for classes and structs, and parses
the rest of the line to the semicolon after the class scope.
This allowed us to remove a long-standing wart in the parser that would
just much the semicolon after any block.
Due to this suboptimal formating some tests were broken.

Some unrelated formatting tests broke; those hit a bug in the ast
printing, and need to be fixed separately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
f0ab0a38d9482eef5495db845ff53ee689f9c80e 07-Jan-2013 Manuel Klimek <klimek@google.com> s/parseStatement/parseStructuralElement/g in the UnwrappedLineParser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
cd162384a552ef4e4913244f4f14b9a3e5a791e1 07-Jan-2013 Daniel Jasper <djasper@google.com> Reformat clang-formats source code.

All changes done by clang-format itself. No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
dd5b1018d97a9666da92d320485a727ac63ee89a 07-Jan-2013 Manuel Klimek <klimek@google.com> Fix incorrect FIXME.

The case that we wanted to write a test for cannot happen, as the
UnwrappedLineParser already protects against it. Added an assert to
prevent regressions of that assumption.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
c3d0c82ab0ce17c684c0192f14059d8e4d63156c 07-Jan-2013 Manuel Klimek <klimek@google.com> Remove outdated FIXME and add explanation for error handling strategy
while parsing #define's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a5342db6fcc6ee3fae084f584ecb019726de9cca 06-Jan-2013 Manuel Klimek <klimek@google.com> Fixes handling of unbalances braces.

If we find an unexpected closing brace, we must not stop parsing, as
we'd otherwise not layout anything beyond that point.

If we find a structural error on the highest level we'll not re-indent
anyway, but we'll still want to format within unwrapped lines.

Needed to introduce a differentiation between an expected and unexpected
closing brace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
f6fd00b12ae7d89436d32851c9bcc8dd3d046ad3 05-Jan-2013 Manuel Klimek <klimek@google.com> Fixes parsing of hash tokens in the middle of a line.

To parse # correctly, we need to know whether it is the first token in a
line - we can deduct this either from the whitespace or seeing that the
token is the first in the file - we already calculate this information.
This patch moves the identification of the first token into the
getNextToken method and stores it inside the FormatToken, so the
UnwrappedLineParser can stay independent of the SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
c37b4d60f926bf440dfcc312bd6482fed3176e33 05-Jan-2013 Manuel Klimek <klimek@google.com> Fixes PR14801 - preprocessor directives shouldn't be indented

Uses indent 0 for macros for now and resets the indent state to the
level prior to the preprocessor directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
6f8424b79863fc9810393c95ecdee97895ab6f26 05-Jan-2013 Manuel Klimek <klimek@google.com> Fixes PR14811: Crash when formatting some macros

A preprocessor directive cannot be started while we're parsing one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d4397b99e2fcb189002d04410d7c3bf85ab4bba3 05-Jan-2013 Manuel Klimek <klimek@google.com> Various fixes to clang-format's macro handling.

Some of this is still pretty rough (note the load of FIXMEs), but it is
strictly an improvement and fixes various bugs that were related to
macro processing but are also imporant in non-macro use cases.

Specific fixes:
- correctly puts espaced newlines at the end of the line
- fixes counting of white space before a token when escaped newlines are
present
- fixes parsing of "trailing" tokens when eof() is hit
- puts macro parsing orthogonal to parsing other structure
- general support for parsing of macro definitions

Due to the fix to format trailing tokens, this change also includes a
bunch of fixes to the c-index tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a080a187fa7e538da3212c7d5e678e4b7ae03253 02-Jan-2013 Manuel Klimek <klimek@google.com> Fixes use of unescaped newlines when formatting preprocessor directives.

This is the first step towards handling preprocessor directives. This
patch only fixes the most pressing issue, namely correctly escaping
newlines for tokens within a sequence of a preprocessor directive.

The next step will be to fix incorrect format decisions on #define
directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
1f94f2b484dc74e09fe31dd5ea9d3f715be6c133 30-Dec-2012 Dmitri Gribenko <gribozavr@gmail.com> Formatter: parse and format inline namespaces like regular namespaces

This changes formatting from:

inline namespace X {
class A {
};
}

to:

inline namespace X {
class A {
};
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
d7610b8a744b2459ce2e66fea7d3a3d56ce23dba 24-Dec-2012 Daniel Jasper <djasper@google.com> Let clang-format format itself.

Apply all formatting changes that clang-format would apply to its own source
code. All choices seem to improve readability (or at least not make it worse).
No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
05b1ac8791ee89fdf0b275631ab8118febc7c33d 17-Dec-2012 Daniel Jasper <djasper@google.com> Fix several formatting problems.

More specifically:
- Improve formatting of static initializers.
- Fix formatting of lines comments in enums.
- Fix formmating of trailing line comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
56e49c5cc2b05e805c7aa9dc53672711e540d58b 10-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format: error recovery for access specifiers

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
469a21b14c8d00001ad30a925020ee5a81c9b8b5 07-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format: extracted FormatTokenSource from UnwrappedLineParser.

Summary: FormatTokenLexer is here, FormatTokenBuffer is on the way. This will allow to re-parse unwrapped lines when needed.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
15757316d67cb7a854d53a0402d67ad58347600a 06-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format: IndentCaseLabels option, proper namespace handling

Summary: + tests arranged in groups, as their number is already quite large.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a3a2b3a1e86a93d2044106046a4dca13a3558fba 06-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format: detect unbalanced braces.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits, silvas

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
2e97cfc78743fcaa988e3c45f7af1002063f780c 05-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format: parse for and while loops

Summary: Adds support for formatting for and while loops.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
33182dd0f7d5b5e913b1957c2cb6dc04942efd46 05-Dec-2012 Daniel Jasper <djasper@google.com> Indentation fixes for clang-format.

- Fix behavior of memoization together with optimization
- Correctly attribute the PenaltyIndentLevel (breaking directly after "(" did
not count towards the inner level)
- Recognize more tokens as assignments

Review: http://llvm-reviews.chandlerc.com/D172

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
720ffb644400661b927c6359aac5677dab036ed4 05-Dec-2012 Alexander Kornienko <alexfh@google.com> Follow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
cff563c0123bbb8d959c93ed371d27cbc6bc4a29 04-Dec-2012 Alexander Kornienko <alexfh@google.com> Error recovery part 2

Summary: Adds recovery for structural errors in clang-format.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, silvas

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
393b008bcebb0a678a5a0a93ad69e28a30a62e84 04-Dec-2012 Alexander Kornienko <alexfh@google.com> Clang-format error recovery part 1

Reviewers: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
a166e73d39d2f554d0f35f94c9804284d1ff804a 04-Dec-2012 Alexander Kornienko <alexfh@google.com> Enum formatting implementation

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp
bac016bd3f67ca2f4db1ddc619e611759352b84d 03-Dec-2012 Daniel Jasper <djasper@google.com> Initial version of formatting library.

This formatting library will be used by a stand-alone clang-format tool
and can also be used when writing other refactorings.

Manuel's original design document:
https://docs.google.com/a/google.com/document/d/1gpckL2U_6QuU9YW2L1ABsc4Fcogn5UngKk7fE5dDOoA/edit

The library can already successfully format itself.

Review: http://llvm-reviews.chandlerc.com/D80

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.cpp