History log of /external/clang/lib/Format/UnwrappedLineParser.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3ea9e33ea25e0c2b12db56418ba3f994eb662c04 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master clang for rebase to r233350

Change-Id: I12d4823f10bc9e445b8b86e7721b71f98d1df442
/external/clang/lib/Format/UnwrappedLineParser.h
0e2c34f92f00628d48968dfea096d36381f494cb 23-Mar-2015 Stephen Hines <srhines@google.com> Update aosp/master clang for rebase to r230699.

Change-Id: I6a546ab3d4ae37119eebb735e102cca4f80ab520
/external/clang/lib/Format/UnwrappedLineParser.h
176edba5311f6eff0cad2631449885ddf4fbc9ea 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master Clang for rebase to r222490.

Change-Id: Ic557ac55e97fbf6ee08771c7b7c3594777b0aefd
/external/clang/lib/Format/UnwrappedLineParser.h
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Format/UnwrappedLineParser.h
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Format/UnwrappedLineParser.h
aabfb2712e180bb11e5dfc4f2a273890a6c5da66 13-Oct-2013 Manuel Klimek <klimek@google.com> Automatically munch semicolons after blocks.

While it is mostly a user error to have the extra semicolon,
formatting it graciously will correctly format in the cases
where we do not fully understand the code (macros).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
ae76f7f850a9101a20191b10241ca72c23dc40dd 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 <
#ifdef A
MyType<Some> >
#else
Type1, Type2>
#endif
param2,
#endif
param3) {
f();
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
5798120bc015360951d13a06e17501b909ecd21d 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
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
b48aeb0c6422e2781ffb2d4627dc7c94f5cec9bc 05-Sep-2013 Douglas Gregor <dgregor@apple.com> Unbreak build with libc++, whose std::list<T> requires T to be complete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
567dcf95424d69657f75e4bfd028967ca1f9eb8d 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();
},
{
long_statement();
long_statement_2();
},
{ short_statement(); }, "");

This fixes llvm.org/PR15381.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
753a5114f9076c545c33cf3ced0d76e27bc0a2d5 04-Sep-2013 Manuel Klimek <klimek@google.com> Implement parsing of blocks (^{ ... }) in the unwrapped line parser.

This patch makes sure we produce the right number of unwrapped lines,
a follow-up patch will make the whitespace formatting consistent.

Before:
void f() {
int i = {[operation setCompletionBlock : ^{ [self onOperationDone];
}]
}
;
}

After:
void f() {
int i = {[operation setCompletionBlock : ^{
[self onOperationDone];
}] };
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
b61a8afba4120f5f1f1af4c7d2a6646a65bd8020 03-Sep-2013 Manuel Klimek <klimek@google.com> First step towards correctly formatting lambdas.

Implements parsing of lambdas in the UnwrappedLineParser.
This introduces the correct line breaks; the formatting of
lambda captures are still incorrect, and the braces are also
still formatted as if they were braced init lists instead of
blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189818 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
eff18b9b6f1218a6bbe4869989b08867823a4e75 01-Aug-2013 Daniel Jasper <djasper@google.com> clang-format: Add more options to namespace indentation.

With this patch, clang-format can be configured to:
* not indent in namespace at all (former behavior).
* indent in namespace as in other blocks.
* indent only in inner namespaces (as required by WebKit style).

Also fix alignment of access specifiers in WebKit style.

Patch started by Marek Kurdej. Thank you!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
0de1c4d152b5fbf0b383e9fa8396e334f029c716 09-Jul-2013 Daniel Jasper <djasper@google.com> Fix alignment of closing brace in braced initializers.

Before:
someFunction(OtherParam, BracedList{
// comment 1 (Forcing intersting break)
param1, param2,
// comment 2
param3, param4
});
After:
someFunction(OtherParam, BracedList{
// comment 1 (Forcing intersting break)
param1, param2,
// comment 2
param3, param4
});

To do so, the UnwrappedLineParser now stores the information about the
kind of brace in the FormatToken.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
2a409b62126d8f0b8f5749d5ed435ad2b394b526 08-Jul-2013 Daniel Jasper <djasper@google.com> Reformat clang-format's source files after r185822 and others.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
3b71155dc93fb3556dfe8b758ae6e448b6fbb9c8 03-Jun-2013 Alexander Kornienko <alexfh@google.com> Moved FormatToken to a separate header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
b398701e4cbb9a55d90a60e3f4f4bc577446d098 29-May-2013 Manuel Klimek <klimek@google.com> The second step in the token refactoring.

Gets rid of AnnotatedToken, putting everything into FormatToken.
FormatTokens are created once, and only referenced by pointer. This
enables multiple future features, like having tokens shared between
multiple UnwrappedLines (while there's still work to do to fully enable
that).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
dcb3f2aab329c80e97a44312d15299df4dc059be 28-May-2013 Manuel Klimek <klimek@google.com> Make UnwrappedLines and AnnotatedToken contain pointers to FormatToken.

The FormatToken is now not copyable any more.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
96e888b0dd3f114eee7e4455a74b8cb5f52e071d 28-May-2013 Manuel Klimek <klimek@google.com> A first step towards giving format tokens pointer identity.

With this patch, we create all tokens in one go before parsing and pass
an ArrayRef<FormatToken*> to the UnwrappedLineParser. The
UnwrappedLineParser is switched to use pointer-to-token internally.

The UnwrappedLineParser still copies the tokens into the UnwrappedLines.
This will be fixed in an upcoming patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
c04a5c38c8b1f317f4e606bd27baeba04b9b74ef 27-May-2013 David Blaikie <dblaikie@gmail.com> Remove unreachable return

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
de008c0f3bf66103185fc9f7f49995fa431451a6 27-May-2013 Manuel Klimek <klimek@google.com> Major refactoring of BreakableToken.

Unify handling of whitespace when breaking protruding tokens with other
whitespace replacements.

As a side effect, the BreakableToken structure changed significantly:
- have a common base class for single-line breakable tokens, as they are
much more similar
- revamp handling of multi-line comments; we now calculate the
information about lines in multi-line comments similar to normal
tokens, and always issue replacements

As a result, we were able to get rid of special casing of trailing
whitespace deletion for comments in the whitespace manager and the
BreakableToken and fixed bugs related to tab handling and escaped
newlines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
b3778a61acca8ed127ba1b23013ca4c530539247 27-May-2013 Manuel Klimek <klimek@google.com> Address post-review comment from dblakie.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
6fb46b02599493d16e5130eff61050c72f65f89e 24-May-2013 Alexander Kornienko <alexfh@google.com> Ignore contents of #if 0 blocks.

Summary:
Added stack of preprocessor branching directives, and ignore all tokens
inside #if 0 except for preprocessor directives.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
ad3094b7d85a4f8eeaf3f60364d5e8796537f061 23-May-2013 Manuel Klimek <klimek@google.com> Use a SourceRange for the whitespace location in FormatToken.

Replaces the use of WhitespaceStart + WhitspaceLength.
This made a bug in the formatter obvous where we would incorrectly
calculate the next column.

FIXME: There's a similar bug left regarding TokenLength. We should
probably also move to have a TokenRange instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
a3e21792f8774aa82964d52f8804f84152f79363 23-May-2013 Manuel Klimek <klimek@google.com> Fix no-assert compiles.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
80829bd8c3161cb706e28f29ac17a871f5eaaa5b 23-May-2013 Manuel Klimek <klimek@google.com> Expand parsing of braced init lists.

Allows formatting of C++11 braced init list constructs, like:
vector<int> v { 1, 2, 3 };
f({ 1, 2 });

This involves some changes of how tokens are handled in the
UnwrappedLineFormatter. Note that we have a plan to evolve the
design of the token flow into one where we create all tokens
up-front and then annotate them in the various layers (as we
currently already have to create all tokens at once anyway, the
current abstraction does not help). Thus, this introduces
FIXMEs towards that goal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182568 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
caf42a3ef114900fd2ab927d1a13b4db000515e8 15-May-2013 Daniel Jasper <djasper@google.com> Remove diagnostics from clang-format.

We only ever implemented one and that one is not actually all that
helpful (e.g. gets incorrectly triggered by macros).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
919398bb40d5d643f38b6595f5e8eac641e89d50 17-Apr-2013 Alexander Kornienko <alexfh@google.com> Unified token breaking logic: support for line comments.

Summary:
Added BreakableLineComment, moved common code from
BreakableBlockComment to newly added BreakableComment. As a side-effect of the
rewrite, found another problem with escaped newlines and had to change
code which removes trailing whitespace from line comments not to break after
this patch.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
67d080dafa74c7d126da522fec333a6e52a5ae35 12-Apr-2013 Manuel Klimek <klimek@google.com> Revamps structural error detection / handling.

Previously we'd only detect structural errors on the very first level.
This leads to incorrectly balanced braces not being discovered, and thus
incorrect indentation.

This change fixes the problem by:
- changing the parser to use an error state that can be detected
anywhere inside the productions, for example if we get an eof on
SOME_MACRO({ some block <eof>
- previously we'd never break lines when we discovered a structural
error; now we break even in the case of a structural error if there
are two unwrapped lines within the same line; thus,
void f() { while (true) { g(); y(); } }
will still be re-formatted, even if there's missing braces somewhere
in the file
- still exclude macro definitions from generating structural error;
macro definitions are inbalanced snippets

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
1eee6c4269af28eb4e3500de7fc39c1eb8b26aa3 04-Mar-2013 Daniel Jasper <djasper@google.com> Format a line if a range in its leading whitespace was selected.

With [] marking the selected range, clang-format invoked on

[ ] int a;

Would so far not reformat anything. With this patch, it formats a
line if its leading whitespace is touched.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
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.h
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.h
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.h
ba287dc2fa46af68a84d69004ffc086e3e7311f1 18-Jan-2013 Manuel Klimek <klimek@google.com> Fix comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
3f8cdbf9932c874b7ca4ee3d850a236d9c729961 16-Jan-2013 Daniel Jasper <djasper@google.com> Calculate the total length of a line up to each token up front.

This makes the tedious fitsIntoLimit() method unnecessary and I can
replace one hack (constructor initializers) by a slightly better hack.

Furthermore, this will enable calculating whether a certain part of a
line fits into the limit for future modifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
9541938d4e3b9cbafdf0e1a28900c535b82767a4 07-Jan-2013 Manuel Klimek <klimek@google.com> Fix layouting of tokens with a leading escaped newline.

If a token follows directly on an escaped newline, the escaped newline
is stored with the token. Since we re-layout escaped newlines, we need
to treat them just like normal whitespace - thus, we need to increase
the whitespace-length of the token, while decreasing the token length
(otherwise the token length contains the length of the escaped newline
and we double-count it while indenting).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
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.h
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.h
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.h
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.h
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.h
422daa1b838788c3ef564640f9d91f52d7deffbe 07-Dec-2012 Matt Beaumont-Gay <matthewbg@google.com> Appease -Wnon-virtual-dtor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
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.h
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.h
accb0b0ad36138855e7d81f210588ad9b3c9de48 04-Dec-2012 Daniel Jasper <djasper@google.com> Add missing destructors found with -Wnon-virtual-dtor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/UnwrappedLineParser.h
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.h
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.h
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.h