4967a710c84587c654b56c828382219c3937dacb |
|
20-Sep-2016 |
Pirama Arumuga Nainar <pirama@google.com> |
Update aosp/master Clang for rebase to r275480 Bug: http://b/31320715 This merges commit ac9cc4764cf47a6c3f031687d8592e080c9f5001 from aosp/dev. Test: Build AOSP and run RenderScript tests (host tests for slang and libbcc, RsTest, CTS) Change-Id: Ic2875e5c3673c83448cd7d1013861e42947b1b55
/external/clang/lib/Format/Format.cpp
|
87d948ecccffea9e9e37d0d053b246e2d6d6c47b |
|
04-Mar-2016 |
Pirama Arumuga Nainar <pirama@google.com> |
Update aosp/master clang for rebase to r256229 http://b/26987366 Change-Id: I5d349c9843ea5c24d6e455956f8a446393b6873d
/external/clang/lib/Format/Format.cpp
|
b6d6993e6e6d3daf4d9876794254d20a134e37c2 |
|
01-Jul-2015 |
Pirama Arumuga Nainar <pirama@google.com> |
Update aosp/master clang for rebase to r239765 Change-Id: I0393bcc952590a7226af8c4b58534a8ee5fd2d99
/external/clang/lib/Format/Format.cpp
|
58878f85ab89b13e9eea4af3ccf055e42c557bc8 |
|
06-May-2015 |
Pirama Arumuga Nainar <pirama@google.com> |
Update aosp/master clang for rebase to r235153 Change-Id: Ia94bbcb6da7c75b6e7c2afedd1001094d62a7324
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
0e2c34f92f00628d48968dfea096d36381f494cb |
|
23-Mar-2015 |
Stephen Hines <srhines@google.com> |
Update aosp/master clang for rebase to r230699. Change-Id: I6a546ab3d4ae37119eebb735e102cca4f80ab520
/external/clang/lib/Format/Format.cpp
|
176edba5311f6eff0cad2631449885ddf4fbc9ea |
|
01-Dec-2014 |
Stephen Hines <srhines@google.com> |
Update aosp/master Clang for rebase to r222490. Change-Id: Ic557ac55e97fbf6ee08771c7b7c3594777b0aefd
/external/clang/lib/Format/Format.cpp
|
c568f1e98938584c0ef0b12ae5018ff7d90a4072 |
|
21-Jul-2014 |
Stephen Hines <srhines@google.com> |
Update Clang for rebase to r212749. This also fixes a small issue with arm_neon.h not being generated always. Includes a cherry-pick of: r213450 - fixes mac-specific header issue r213126 - removes a default -Bsymbolic on Android Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Format/Format.cpp
|
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 |
|
29-May-2014 |
Stephen Hines <srhines@google.com> |
Update Clang for 3.5 rebase (r209713). Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Format/Format.cpp
|
651f13cea278ec967336033dd032faef0e9fc2ec |
|
24-Apr-2014 |
Stephen Hines <srhines@google.com> |
Updated to Clang 3.5a. Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Format/Format.cpp
|
b2ea69583aaff9fcc7b14c4c87ea2deda6c779c8 |
|
19-Nov-2013 |
Bill Wendling <isanbard@gmail.com> |
Merging r195128: ------------------------------------------------------------------------ r195128 | alexfh | 2013-11-19 06:30:44 -0800 (Tue, 19 Nov 2013) | 11 lines Refactoring: replaced (*(I + x)) with I[x]. Summary: Pure refactoring, no semantic changes intended. Reviewers: klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2220 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a9f280942e3129a3d9e051bcf1bb5616243f212c |
|
13-Nov-2013 |
Alexander Kornienko <alexfh@google.com> |
Correctly mark first token in the presence of UTF-8 BOM. Summary: Fixes http://llvm.org/PR17753 Reviewers: klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2159 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c2e0329c8b84b16252184db4dd575c9e9fb93efe |
|
08-Nov-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't auto-break short macros in WebKit style. This fixes llvm.org/PR17842. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1a896a5a72d9af0259afe636535254c95dc6b355 |
|
08-Nov-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Make breaking before ternary operators configurable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4281d73fb795ef867d4d4257023bef90d6f9c520 |
|
07-Nov-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Separate line-merging logic into its own class. No functional changes (intended). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194179 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2a80ad6fe7aa506b1df2bb638bc367d9e760f707 |
|
05-Nov-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Allow line merging and partial formatting of nested blocks Before, clang-format would always format entire nested blocks, which can be unwanted e.g. for long DEBUG({...}) statements. Also clang-format would not allow to merge lines in nested blocks (e.g. to put "if (a) return;" on one line in Google style). This is the first step of several refactorings mostly focussing on the additional functionality (by reusing the "format many lines" code to format the children of a nested block). The next steps are: * Pull out the line merging into its own class. * Seperate the formatting of many lines from the formatting of a single line (and the analysis of the solution space). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d8ee5c1c8709c5fc060a48b598112f6eadb35d96 |
|
29-Oct-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Option to control spacing in template argument lists. Same as SpacesInParentheses, this option allows adding a space inside the '<' and '>' of a template parameter list. Patch by Christopher Olsen. This fixes llvm.org/PR17301. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
28ce23a550d386b32aa60abbbf308d164992eb1e |
|
25-Oct-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
I am about to change llvm::MemoryBuffer::getFile take take a Twine. Change clang first so that the build still works. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
47066e46b9ce4f830ead3c7b9a4cb5bf0ac2c857 |
|
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( 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
15eef85d4f918834ab83cfb941663463b573d6bf |
|
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(); }); This fixed llvm.org/PR17619. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0baf33b73e2bd6657ee202e2016daf010b8b58b9 |
|
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 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c2827ec708b1611f2b0717bebc423b17a857631e |
|
18-Oct-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Make continuation indent width configurable. Patch by Kim Gräsman. Thank you! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f0fc89c358cdd0717c0e12eb4a90e4a6ce956e98 |
|
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 fixed incorrect indentation level calculation in formatFirstToken. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
78a4e619e775b0dbaa10c9feaea0adf1d3dfe507 |
|
12-Oct-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: No space in "<::" in C++11 mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
1d82b1a33bcfe85f4834fb6920517ed07e9355d3 |
|
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-format simply treated them as whitespace and removed them prior to this patch. This fixes llvm.org/PR17215 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
63cfb89cf75300b62f3aa1debaa44a4a1ce83b45 |
|
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(); }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f4e12c8c1325ea04b54ed0b5869258254458b091 |
|
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 tools that use libFormat and also have a -style option to behave consistently with clang-format. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3d9ffcf3aa0ed84fa297e3c461bb84e48221aa2d |
|
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 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9b4de85e2f47a01974f451d21fed0276ff912e32 |
|
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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2c2f729d10cb10324bf2e7871867f7bbc19ad358 |
|
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: cfe-commits, klimek, rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1640 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
73d845cbe26df2fb188e30853efb8ce4b0556afe |
|
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 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6f6154c5f5976e3e57f34f6a755bdfa95b7ff745 |
|
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, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1638 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
83a7dcdf5fce1bdf74ce985419d77a41a51abfa2 |
|
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: klimek, djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1608 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
14e25c0477bf9f51e980fdc23b7f0bff800f3ae7 |
|
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. 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; }); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
51bb5d967d445613b9f08f6705491966f8616a2a |
|
06-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Don't remove trailing escaped newline from line comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2f0a020d29286805e48b74b127fbf153af2c4ce7 |
|
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().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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b77d741691a2775b5c31e29f021203cc659c26df |
|
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 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0b62cc30c9aa462184de0435dc083d944a41d67f |
|
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 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1a925bce18ea691d9bc7b2810715f37657ca8f51 |
|
05-Sep-2013 |
Daniel Jasper <djasper@google.com> |
Address post-commit review comments from r190038. Mostly additional comments :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
9321e8700275847458de753933689e30a3412fe2 |
|
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4e65c98f67b80a7f85ecd5b550a5e10a834f702c |
|
02-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Added WebKit style to the BasedOnStyle handling and to the relevant help messages. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4b762a91faac0473fa380ea9731992b24867e2e6 |
|
02-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Store first and last newline position in the token text for string literals and comments. Summary: Store first and last newline position in the token text for string literals and comments to avoid doing .find('\n') for each possible solution. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1556 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
dcc0c5bb7ce9a731ecbc0b8e8477979cd9e730c0 |
|
29-Aug-2013 |
Alexander Kornienko <alexfh@google.com> |
Better support for multiline string literals (including C++11 raw string literals). Summary: Calculate characters in the first and the last line correctly so that we only break before the literal when needed. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1544 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c41e8198dc1f24a1c6d35046fc4d478546761648 |
|
29-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Fixes various problems with accounting for tabs in the original code. We now count the original token's column directly when lexing the tokens, where we already have all knowledge about where lines start. Before this patch, formatting: void f() { \tg(); \th(); } would incorrectly count the \t's as 1 character if only the line containing h() was reformatted, and thus indent h() at offset 1. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f54617858a0df936746b7f521a8ffb032289d02f |
|
28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve token breaking behavior. Two changes: * Don't add an extra penalty on breaking the same token multiple times. Generally, we should prefer not to break, but once we break, the normal line breaking penalties apply. * Slightly increase the penalty for breaking comments. In general, the author has put some thought into how to break the comment and we should not overwrite this unnecessarily. With a 40-column column limit, formatting aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa"); Leads to: Before: aaaaaa( "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa"); After: aaaaaa("aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa"); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
259118e66086f1446f1d205de9d51708a6325914 |
|
22-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Work around unused variable warning in release builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d4a03dbb0bdbd4908375306283cb61813bd8f454 |
|
22-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add column layout formatting for braced lists With this patch, braced lists (with more than 3 elements are formatted in a column layout if possible). E.g.: static const uint16_t CallerSavedRegs64Bit[] = { X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI, X86::R8, X86::R9, X86::R10, X86::R11, 0 }; Required other changes: - FormatTokens can now have a special role that contains extra data and can do special formattings. A comma separated list is currently the only implementation. - Move penalty calculation entirely into ContinuationIndenter (there was a last piece still in UnwrappedLineFormatter). Review: http://llvm-reviews.chandlerc.com/D1457 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
34f3d05d0ee625dfcac951e2851f212c4c1a8b83 |
|
21-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Indent relative to unary operators. Before: if (!aaaaaaaaaa( // break aaaaa)) { } After: if (!aaaaaaaaaa( // break aaaaa)) { } Also cleaned up formatting using clang-format. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7df56bfcf7186f73c99564cd54216f07a8db7352 |
|
20-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Additional options for spaces around parentheses. This patch adds four new options to control: - Spaces after control keyworks (if(..) vs if (..)) - Spaces in empty parentheses (f( ) vs f()) - Spaces in c-style casts (( int )1.0 vs (int)1.0) - Spaces in other parentheses (f(a) vs f( a )) Patch by Joe Hermaszewski. Thank you for working on this! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6b2afe445b3cfba4b8ae898f85f3540211bd65f8 |
|
16-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Split UnwrappedLineFormatter into individual components. Goals: Structure code better and make components easier to use for future features (e.g. column layout for long braced initializers). No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6315fec908431be8f11d9e3c29caadc77c748702 |
|
13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add option for the offset of constructor initializers. Some coding styles use a different indent for constructor initializers. Patch by Klemens Baum. Thank you. Review: http://llvm-reviews.chandlerc.com/D1360 Post review changes: Changed data type to unsigned as a negative indent width does not make sense and added test for configuration parsing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b349a78c9705a63a352d7b9210cafb2e9d27047c |
|
12-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve stream-formatting. Before: CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\"" << FLAGS_proto << "\""; After: SemaRef.Diag(Loc, diag::note_for_range_begin_end) << BEF << IsTemplate << Description << E->getType(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
53352600b7370b1d33b9fde1adda207fd9d7dcd1 |
|
12-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Correctly format alias declarations. Before: template <class CallbackClass> using MyCallback = void(CallbackClass::*)(SomeObject * Data);"); After: template <class CallbackClass> using MyCallback = void (CallbackClass::*)(SomeObject *Data);"); Also fix three wrong indentations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d3a247cc4e136af6b71dc5968ca6190e6c68f4c5 |
|
07-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Fixes a couple of bugs with the Allman brace breaking. In particular, left braces after an enum declaration now occur on their own line. Further, when short ifs/whiles are allowed these no longer cause the left brace to be on the same line as the if/while when a brace is included. Patch by Thomas Gibson-Robinson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e490705e6678a2e830cecacbe8142d9b369d8341 |
|
02-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Implement Allman style. Patch by Frank Miller. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
75e58bb0bde79d18ed4436769f017b5496745009 |
|
02-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix string breaking after "<<". Before, clang-format would not break overly long string literals following a "<<" with FormatStyle::AlwaysBreakBeforeMultilineStrings being set. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ab3ce592d027e3a10fb21e703cab1507f8d9bb03 |
|
02-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't break empty 2nd operand of ternary expr. Before: some_quite_long_variable_name_ptr ? : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6]; After: some_quite_long_variable_name_ptr ?: argv[9] ? ptr : argv[8] ?: argv[7] ? ptr : argv[6]; Patch by Adam Strzelecki, thank you!! This fixed llvm.org/PR16758. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b7000ca629da16164f0073f5a7f9459ddf5ba281 |
|
01-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Teach clang-format to understand static_asserts better. Before: template <bool B, bool C> class A { static_assert(B &&C, "Something is wrong"); }; After: template <bool B, bool C> class A { static_assert(B && C, "Something is wrong"); }; (Note the spacing around '&&'). Also change the identifier table to always understand all C++11 keywords (which seems like the right thing to do). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
893ea8d0a6420591d966fa0e7135e510b1523b57 |
|
01-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Make alignment of trailing comments optional .. .. in order to support WebKit style properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
e8b10d3d5b90efaf60ad89e96f6500f971ceec41 |
|
26-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add two new style options to support WebKit style. New options: * Break before the commas of constructor initializers and align the commas with the colon. * Break before binary operators Additionally, for styles without column limit, don't just accept linebreaks done by the user, but instead remove 'invalid' (according to the current style) linebreaks and add 'required' ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e05dc6d1b5eb12d47c8d3cb5120452ceef720568 |
|
24-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Initial (incomplete) support for the WebKit coding style. This is far from implementing all the rules given by http://www.webkit.org/coding/coding-style.html The important new feature is the support for styles that don't have a column limit. For such styles, clang-format will (at the moment) simply respect the input's formatting decisions within statements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
215c57ff4a75388913dc392d03d84ec8c4c3ee1e |
|
17-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Improve line breaking before multi-line strings. The AlwaysBreakBeforeMultilineStrings rule does not really make sense if it does not a column gain. Before (in Google style): f( "aaaa" "bbbb"); After: f("aaaa" "bbbb"); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b4b4a52f1c3b768473169bc7cb450d406e1b495c |
|
17-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Avoid breaking non-trailing block comments. Motivating example: // column limit -------------------> void ffffffffffff(int aaaaaa /* test */); Formatting before the patch: void ffffffffffff(int aaaaaa /* test */); Formatting after the patch: void ffffffffffff(int aaaaaa /* test */); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
10c26b2e974f97c75fc3aaa302ca750f422cbce1 |
|
16-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Don't break line comments with escaped newlines. Summary: These can appear when comments contain command lines with quoted line breaks. As the text (including escaped newlines and '//' from consecutive lines) is a single line comment, we used to break it even when it didn't exceed column limit. This is a temporary solution, in the future we may want to support this case completely - at least adjust leading whitespace when changing indentation of the first line. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1146 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
561211d35b5a2825fba6d0c017044f6896b204fd |
|
16-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve handling of unterminated string literals. Before, clang-format would simply eat these as they were recognized as whitespace. With this patch, they are mostly left alone. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b5dc3f4f53981b681a565cdf1d49f18e817541ff |
|
16-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Revamp the formatting of C++11 braced init lists. The fundamental concept is: Format as if the braced init list was a function call (with parentheses replaced by braces). If there is no name/type before the opening brace (e.g. if the braced list is nested), assume a zero-length identifier just before the opening brace. This behavior is gated on a new style flag, which for now replaces the SpacesInBracedLists style flag. Activate this style flag for Google style to reflect recent style guide changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9637dda705e39110bfff66742542a58dd2470ad2 |
|
15-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Improvement of change r186320. Fixed a test that by now passed for the wrong reason. Before: llvm::outs() << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: llvm::outs() << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa); Also reformatted Format.cpp with the latest changes (1 formatting fix and 1 layout change of a <<-chain). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3e12e87f98538c55c1eab79df79e5a00df6de8ec |
|
15-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of operator<< chains. Before: llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa; After: llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a0740f5ddf143d59b8e55d2cb6e39ed5059575b4 |
|
12-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve <<-formatting. This fixes a regression caused by r186115. Before: Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0fde9504af582459c93c43363db2680bcd726126 |
|
12-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix string literal breaking. Before this patch, it did not cooperate with Style::AlwaysBreakBeforeMultilineStrings. Thus, it would turn aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa"); into: aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa"); and only a second format step would lead to the desired (with that option): aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa"); This could even lead to clang-format breaking the string at a different character and thus leading to a completely different end result. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
011c35dabb4c8abcb7389d8fbc6316f8f23576ab |
|
12-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Break before/between array subscript expressions. clang-format used to treat array subscript expressions much like function call (just replacing () with []). However, this is not really appropriate especially for expressions with multiple subscripts. Although it might seem counter-intuitive, the most consistent solution seems to be to always (if necessary) break before a square bracket, never after it. Also, multiple subscripts of the same expression should be aligned if they are on subsequent lines. Before: aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa][ bbbbbbbbbbbbbbbbbbbbbbbbb] = c; aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa][ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc; After: aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa] [bbbbbbbbbbbbbbbbbbbbbbbbb] = c; aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] [bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
15ec3a871d5ae8a8d4c29ca2681532a9894898b6 |
|
11-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug concerning the alignment of "}". Before: int i; // indented 2 space more than clang-format would use. SomeReturnType // clang-format invoked on this line. SomeFunctionMakingLBraceEndInColumn80() { } // This is the indent clang-format would prefer. After: int i; // indented 2 space more than clang-format would use. SomeReturnType // clang-format invoked on this line. SomeFunctionMakingLBraceEndInColumn80() { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
faec47bcbadf462b3ac82618dcfca6ae3b8ce5d9 |
|
11-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Avoid line breaks before the first <<. This puts a slight penalty on the linebreak before the first "<<", so that clang-format generally tries to keep things on the first line. User feedback has shown that this is generally desirable. Before: llvm::outs() << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =" << aaaaaaaaaaaaaaaaaaaaaaaaaaa; After: llvm::outs() << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =" << aaaaaaaaaaaaaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e1f9a8e27f553dcb359dfd96a3fe3065de7c4dad |
|
11-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Fix indentation problem for comments in call chains Before: SomeObject // Calling someFunction on SomeObject .someFunction(); After: SomeObject // Calling someFunction on SomeObject .someFunction(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c7bd68f9edcbca95e882d0ab18d09371f0bdb82c |
|
10-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Add experimental flag for adaptive parameter bin-packing. This is not activated for any style, might change or go away completely. For those that want to play around with it, set ExperimentalAutoDetectBinPacking to true. clang-format will then: Look at whether function calls/declarations/definitions are currently formatted with one parameter per line (on a case-by-case basis). If so, clang-format will avoid bin-packing the parameters. If all parameters are on one line (thus that line is "inconclusive"), clang-format will make the choice dependent on whether there are other bin-packed calls/declarations in the same file. The reason for this change is that bin-packing in some situations can be really bad and an author might opt to put one parameter on each line. If the author does that, he might want clang-format not to mess with that. If the author is unhappy with the one-per-line formatting, clang-format can easily be convinced to bin-pack by putting any two parameters on the same line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2ca3741a962ded08866596577aaee2f4ab74c955 |
|
09-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for formatting trailing return types. This fixes llvm.org/PR15170. For now, the basic formatting rules are (based on the C++11 standard): * Surround the "->" with spaces. * Break before "->". Also fix typo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b1491798353b26c07b065c6975a91ff6214b8ff6 |
|
09-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Avoid confusing indentations for chained function calls. Basically treat a function with a trailing call similar to a function with multiple parameters. Before: aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa)) .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); After: aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa)) .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); Also fix typo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
6561f6a13b79ed752748ede590792191edf78ce8 |
|
09-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Format overloaded operators like other functions. This fixes llvm.org/PR16328 (at least partially). Before: SomeLoooooooooooooooooooooooooooooogType operator<<( const SomeLooooooooogType &a, const SomeLooooooooogType &b); After: SomeLoooooooooooooooooooooooooooooogType operator<<(const SomeLooooooooogType &a, const SomeLooooooooogType &b); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
88cc562ad2d3e75280d453f824e89380622f4c9c |
|
08-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Prefer similar line breaks. This adds a penalty for clang-format for each break that occurs in a set of parentheses (including fake parenthesis that determine the range of certain operator precendences) that have not yet been broken. Thereby, clang-format prefers similar line breaks. This fixes llvm.org/PR15506. Before: const int kTrackingOptions = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways; After: const int kTrackingOptions = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways; Also removed ParenState::ForFakeParenthesis which has become unused. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
163fbf810eaffc2c7b0170d91b6196b032911957 |
|
08-Jul-2013 |
Craig Topper <craig.topper@gmail.com> |
Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid specifying the vector size. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
07ca5477461dc1f3efa76ef9cf6f9dbaf66ddb98 |
|
05-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Improve detection for preventing certain kind of formatting patterns. This is a better implementation of r183097. The main purpose is to prevent certain constructs to be formatted "like a block of text". Before: aaaaaaaaaaaaa< aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>* aaaa = new aaaaaaaaaaaaa< aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>(bbbbbbbbbbbbbbbbbbbbbbbb); aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (*cccccccccccccccc)[ dddddddddddddddddddddddddddddddddddddddddddddddddddddddd]; After: aaaaaaaaaaaaa<aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>* aaaa = new aaaaaaaaaaaaa<aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>( bbbbbbbbbbbbbbbbbbbbbbbb); aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (*cccccccccccccccc)[ dddddddddddddddddddddddddddddddddddddddddddddddddddddddd]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0bdc6434fa0fea933b6ab566eff751afdba40a2a |
|
04-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Fixed typo: NoneComment -> NonComment, no other changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
56312023bf62cb40d2e33ea5e14d55c1e42303a7 |
|
04-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Added AlwaysBreakBeforeMultilineStrings option. Summary: Always breaking before multiline strings can help format complex expressions containing multiline strings more consistently, and avoid consuming too much horizontal space. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1097 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc |
|
03-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Don't insert confusing line breaks in comparisons. In general, clang-format breaks after an operator if the LHS spans multiple lines. Otherwise, this can lead to confusing effects and effectively hide the operator precendence, e.g. in if (aaaaaaaaaaaaaa == bbbbbbbbbbbbbb && c) { ... This patch removes this rule for comparisons, if the LHS is not a binary expression itself as many users were wondering why clang-format inserts an unnecessary linebreak. Before: if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) > 5) { ... After: if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) > 5) { ... In the long run, we might: - Want to do this for other binary expressions as well. - Do this only if the RHS is short or even only if it is a literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d446f737f0c4840f25a371bfc9ebedab69e4027d |
|
01-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Avoid column limit violation in block comments in certain cases. Summary: Add penalty when an excessively long line in a block comment can not be broken on a leading whitespace. Lack of this addition can lead to severe column width violations when they can be easily avoided. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1071 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
83f81d712616130e62487f76522702fb8bca5002 |
|
01-Jul-2013 |
Craig Topper <craig.topper@gmail.com> |
Put helper classes into anonymous namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a1753f4be12737f36ce9c6eccccddd3be1ec514b |
|
28-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Use lexing mode based on FormatStyle.Standard. Summary: Some valid pre-C++11 constructs change meaning when lexed in C++11 mode, e.g. #define x(_a) printf("foo"_a); (example from http://llvm.org/bugs/show_bug.cgi?id=16342). "foo"_a is treated as a user-defined string literal when parsed in C++11 mode. In order to deal with this correctly, we need to set lexing mode according to which standard the code conforms to. We already have a configuration value for this (FormatStyle.Standard), which seems to be appropriate to use in this case as well. Reviewers: klimek CC: cfe-commits, gribozavr Differential Revision: http://llvm-reviews.chandlerc.com/D1028 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1907c57be5319397b722cbd3b8a4cdf2dbb8ce29 |
|
26-Jun-2013 |
Nico Weber <nicolasweber@gmx.de> |
Fix a comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2726877196b41b922f10f794801b313980e1a8ad |
|
26-Jun-2013 |
Nico Weber <nicolasweber@gmx.de> |
Run clang-format on lib/Format code after r184894. No other changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a9a7f108a4a10da1f08fd4538a15f441bfee72c1 |
|
21-Jun-2013 |
Manuel Klimek <klimek@google.com> |
Add an option to not indent declarations when breaking after the type. Make that option the default for LLVM style. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c36c5c247f53b0517b141ae5ae93f4580e9452ba |
|
19-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Fixed long-standing issue with incorrect length calculation of multi-line comments. Summary: A trailing block comment having multiple lines would cause extremely high penalties if the summary length of its lines is more than the column limit. Fixed by always considering only the last line of a multi-line block comment. Removed a long-standing FIXME from relevant tests and added a motivating test modelled after problem cases from real code. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1010 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
22d0e2985d00010ed1d56168985ca34adc75b80a |
|
17-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Fixes incorrect indentation of line comments after break and re-alignment. Summary: Selectively propagate the information about token kind in WhitespaceManager::replaceWhitespaceInToken.For correct alignment of new segments of line comments in order to align them correctly. Don't set BreakBeforeParameter in breakProtrudingToken for line comments, as it introduces a break after the _next_ parameter. Added tests for related functions. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D980 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
16a0ec60507a4eec275a5c3a86d4501b1b7b817b |
|
14-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Don't remove backslashes from block comments. Summary: Don't remove backslashes from block comments. Previously this /* \ \ \ \ \ \ */ would be turned to this: /* */ which spoils some kinds of ASCII-art, people use in their comments. The behavior was related to handling escaped newlines in block comments inside preprocessor directives. This patch makes handling it in a more civilized way. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D979 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e3f1197cad5cda243093e8b39caa43f13111de89 |
|
12-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Preserve newlines before block comments in static initializers. Summary: Basically, don't special-case line comments in this regard. And fixed an incorrect test, that relied on the wrong behavior. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D962 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
54e6c9d1f15153d1756642080866f10a91cc86ea |
|
07-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Improved handling of escaped newlines at the token start. Summary: Remove them from the TokenText as well. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D935 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2785b9aabcb2c3fd6f7dd8b63d3cd3d4b9bca284 |
|
07-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Fixed calculation of penalty when breaking tokens. Summary: Introduced two new style parameters: PenaltyBreakComment and PenaltyBreakString. Add penalty for each character of a breakable token beyond the column limit (this relates mainly to comments, as they are broken only on whitespace). Tuned PenaltyBreakComment to prefer comment breaking over breaking inside most binary expressions. Fixed a bug that prevented *, & and && from being considered TT_BinaryOperator in the presense of adjacent comments. Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D933 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
00895106f9ed602af67984ec4d225a0cdc8c12af |
|
05-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
UTF-8 support for clang-format. Summary: Detect if the file is valid UTF-8, and if this is the case, count code points instead of just using number of bytes in all (hopefully) places, where number of columns is needed. In particular, use the new FormatToken.CodePointCount instead of TokenLength where appropriate. Changed BreakableToken implementations to respect utf-8 character boundaries when in utf-8 mode. Reviewers: klimek, djasper Reviewed By: djasper CC: cfe-commits, rsmith, gribozavr Differential Revision: http://llvm-reviews.chandlerc.com/D918 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183312 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
15f33f03e742fb6567e4789996fa0391a8e18068 |
|
03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Let clang-format remove empty lines before "}". These lines almost never aid readability. Before: void f() { int i; // some variable } After: void f() { int i; // some variable } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ce912f45660613c1bc49696eb07ff7f8aecffe18 |
|
03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Improve detection preventing certain kind of formatting patterns. An oversight in this detection made clang-format unable to format the following nicely: void aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb>( cccccccccccccccccccccccccccc); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5ef8aacd5f25767fc7bd1ec47c2b5f5fd1ac38eb |
|
03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Fix line-breaking problem caused by comment. Before, clang-format would not find a solution for formatting: if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa cccccc) { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183096 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8893b8a28d32359a5c778d9308780200a09402ba |
|
31-May-2013 |
Daniel Jasper <djasper@google.com> |
Make formatting of empty blocks more consistent. With this patch, the simplified rule is: If the block is part of a declaration (class, namespace, function, enum, ..), merge an empty block onto a single line. Otherwise (specifically for the compound statements of if, for, while, ...), keep the braces on two separate lines. The reasons are: - Mostly the formatting of empty blocks does not matter much. - Empty compound statements are really rare and are usually just inserted while still working on the code. If they are on two lines, inserting code is easier. Also, overlooking the "{}" of an "if (...) {}" can be really bad. - Empty declarations are not uncommon, e.g. empty constructors. Putting them on one line saves vertical space at no loss of readability. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183008 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9c333b9c6fa08a6b7169556a6d23dac8b47918c2 |
|
29-May-2013 |
Manuel Klimek <klimek@google.com> |
Use a non-recursive implementation to reconstruct line breaks. Now that the TokenAnnotator does not require stack space anymore, reconstructing the lines has become the limiting factor. This patch fixes that problem, allowing large files with multiple megabytes of single unwrapped lines to be formatted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
bbc8776493fc0176d925a5b528e61ee400895047 |
|
29-May-2013 |
Daniel Jasper <djasper@google.com> |
Add option to always break template declarations. With option enabled (e.g. in Google-style): template <typename T> void f() {} With option disabled: template <typename T> void f() {} Enabling this for Google-style and Chromium-style, not sure which other styles would prefer that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
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/Format.cpp
|
5ad390d27f8f7cb6628bc2c32beba4d25bc2718b |
|
28-May-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for designated initializers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
69c4371a978100d1538f414032f0a8750a0ca63f |
|
28-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of expressions containing ">>". This gets turned into two ">" operators at the beginning in order to simplify template parameter handling. Thus, we need a special case to handle those two binary operators correctly. With this patch, clang-format can now correctly handle cases like: aaaaaa = aaaaaaa(aaaaaaa, // break aaaaaa) >> bbbbbb; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
512843a7dc01a4f1755e699d1e394a691a39c176 |
|
27-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve indentation of assignments. Before: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; After: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
259a038a97c37109752c70a05e17aa811de3bd8f |
|
27-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix hacky way of preventing a certain type of line break. In general, we like to avoid line breaks like: ... SomeParameter, OtherParameter).DoSomething( ... as they tend to make code really hard to read (how would you even indent the next line?). Previously we have implemented this in a hacky way, which has now shown to lead to problems. This fixes a few weird looking formattings, such as: Before: aaaaa( aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .aaaaa(aaaaa), aaaaaaaaaaaaaaaaaaaaa); After: aaaaa(aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).aaaaa(aaaaa), aaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1bee0738b67b784f08d5e2f8351920260c9cfb1d |
|
23-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of braced lists. Before: vector<int> v{ -1}; After: vector<int> v{-1}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
2424eefa6936ec2dc35188e19c99e2f85428b52e |
|
23-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of braced lists. Before: vector<int> x { 1, 2, 3 }; After: vector<int> x{ 1, 2, 3 }; Also add a style option to remove the spaces inside braced lists, so that the above becomes: std::vector<int> v{1, 2, 3}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e573c3f7fc40e813559ab4ff1e7eec4f66f1a50f |
|
22-May-2013 |
Manuel Klimek <klimek@google.com> |
Makes whitespace management more consistent. Instead of selectively storing some changes and directly generating replacements for others, we now notify the WhitespaceManager of the whitespace before every token (and optionally with more changes inside tokens). Then, we run over all whitespace in the very end in original source order, where we have all information available to correctly align comments and escaped newlines. The future direction is to pull more of the comment alignment implementation that is now in the BreakableToken into the WhitespaceManager. This fixes a bug when aligning comments or escaped newlines in unwrapped lines that are handled out of order: #define A \ f({ \ g(); \ }); ... now gets correctly layouted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
24e19e4f96abd12f3f4b72b8a315b8ac257bc88f |
|
22-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix function declaration behavior. This only affects styles that prevent bin packing. There, a break after a template declaration also forced a line break after the function name. Before: template <class SomeType, class SomeOtherType> SomeType SomeFunction(SomeType Type, SomeOtherType OtherType) {} After: template <class SomeType, class SomeOtherType> SomeType SomeFunction(SomeType Type, SomeOtherType OtherType) {} This fixes llvm.org/PR16072. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
54b4e4468ec2bcd381ede70e1391bcdb59b8fd1a |
|
22-May-2013 |
Daniel Jasper <djasper@google.com> |
Cut-off clang-format analysis. If clang-format is confronted with long and deeply nested lines (e.g. complex static initializers or function calls), it can currently try too hard to find the optimal solution and never finish. The reason is that the memoization does not work effectively for deeply nested lines. This patch removes an earlier workaround and instead opts for accepting a non-optimal solution in rare cases. However, it only does so only in cases where it would have to analyze an excessive number of states (currently set to 10000 - the most complex line in Format.cpp requires ~800 states) so this should not change the behavior in a relevant way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
107db3c21133b71962bd8826c16d24652d6042a1 |
|
20-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Minor fix: don't crash on empty configuration file, consider empty configuration files invalid. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
885f87b4be987fd8912779419ec88e3c37481967 |
|
19-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Clang-format: allow -style="{yaml/json}" on command line Summary: + improved handling of default style and predefined styles. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D813 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
399914b7a61a3823cc74ef3e47b1cde42528b9bf |
|
17-May-2013 |
Daniel Jasper <djasper@google.com> |
Slightly modify the formatting rules for braced lists. Basically, the new rule is: The opening "{" always has to be on the same line as the first element if the braced list is nested (e.g. in another braced list or in a function). The solution that clang-format produces almost always adheres to this rule anyway and this makes clang-format significantly faster for larger lists. Added a test cases for the only exception I could find (which doesn't seem to be very important at first sight). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5d5b424589efe6b3dd963cb6a2b71b5583a4f6f2 |
|
16-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't insert a break into include lines with trailing comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f11bbb9b0e9b741c84214459526d3e5e137e9165 |
|
16-May-2013 |
Daniel Jasper <djasper@google.com> |
Add option to put short loops on a single line. This enables things like: for (int &v : vec) v *= 2; Enabled for Google style. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8a99945769aa83270bda4ae4890f519800aa19eb |
|
16-May-2013 |
Daniel Jasper <djasper@google.com> |
Add a more convenient interface to use clang-format. It turns out that several implementations go through the trouble of setting up a SourceManager and Lexer and abstracting this into a function makes usage easier. Also abstracts SourceManager-independent ranges out of tooling::Refactoring and provides a convenience function to create them from line ranges. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
058f6f889a1df37f31bcf6b82060b8f815113471 |
|
16-May-2013 |
Daniel Jasper <djasper@google.com> |
Comments should not prevent single-line functions. Before: void f() {} void g() { } // comment After: void f() {} void g() {} // comment git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9a2f8d07bf820b524c7b23f6f625f206cad3bf96 |
|
16-May-2013 |
Daniel Jasper <djasper@google.com> |
Add back accidentally deleted line and add test for it. Before: f("a", "b" "c"); After: f("a", "b" "c"); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5be59ba8c9fb291f83970f0ebddceda70088bb28 |
|
15-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't put short namespace on a single line. Before: namespace abc { class SomeClass; } namespace def { void someFunction() {} } After: namespace abc { class Def; } namespace def { void someFunction() {} } Rationale: a) Having anything other than forward declaration on the same line as a namespace looks confusing. b) Formatting namespace-forward-declaration-combinations different from other stuff is inconsistent. c) Wasting vertical space close to such forward declarations really does not affect readability. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
33f4b90476f24d269cac04915d951d8f05bd3a77 |
|
15-May-2013 |
Daniel Jasper <djasper@google.com> |
Break function declarations after multi-line return types. Before: template <typename A> SomeLoooooooooooooooooooooongType< typename some_namespace::SomeOtherType<A>::Type> Function() {} After: template <typename A> SomeLoooooooooooooooooooooongType< typename some_namespace::SomeOtherType<A>::Type> Function() {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181877 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9f3216199484a95fd765caa6555fd44e5c0ed1ea |
|
15-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't merge one-line functions in weird brace styles. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
d741f02da9c91c197ba8816b4b454e1ad7cd47b6 |
|
14-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix expression breaking for one-parameter-per-line styles. Before: if (aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} After: if (aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
84f5ddfacc59c5d4878cd47b7794e53dc8e2e9f9 |
|
14-May-2013 |
Daniel Jasper <djasper@google.com> |
Correctly determine ranges for clang-format. We have been assuming that CharSourceRange::getTokenRange() by itself expands a range until the end of a token, but in fact it only sets IsTokenRange to true. Thus, we have so far only considered the first character of the last token to belong to an unwrapped line. This did not really manifest in symptoms as all edit integrations expand ranges to fully lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1fb8d8814ae28a4ebe94652faafad8545a115bfe |
|
14-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix clang-format bug in unwrapped-line merging. Before (in styles that allow it), clang-format would not merge an if statement onto a single line, if only the second line was format (e.g. in an editor integration): if (a) return; // clang-format invoked on this line. With this patch, this gets properly merged to: if (a) return; // ... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2a9805d227375efd988522873d4edc282010baae |
|
14-May-2013 |
Manuel Klimek <klimek@google.com> |
Implement string literal breaking on unbreakable token sequences. This fixes indentation where there are for example multiple closing parentheses after a string literal, and where those parentheses run over the end of the line. During testing this revealed a bug in the implementation of breakProtrudingToken: we don't want to change the state if we didn't actually do anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
27c7f54cf7d18276be2979d5c795533cc5592675 |
|
13-May-2013 |
Daniel Jasper <djasper@google.com> |
Align a multiline string literal with the first part. Before: #define A(X) \ "aaaaa" #X "bbbbbb" \ "ccccc" After: #define A(X) \ "aaaaa" #X "bbbbbb" \ "ccccc" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2b6acb69f04ac5339fd39a9c03a0f5d076d51ac3 |
|
13-May-2013 |
Alexander Kornienko <alexfh@google.com> |
A better version of r181699: use raw_string_ostream.str() instead of manually calling .flush(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
44135b8836fc3ffb84e540d8a097955271ccbc23 |
|
13-May-2013 |
Manuel Klimek <klimek@google.com> |
Implements brace breaking styles. We now support "Linux" and "Stroustrup" brace breaking styles, which gets us one step closer to support formatting WebKit, KDE & Linux code. Linux brace breaking style: namespace a { class A { void f() { if (x) { f(); } else { g(); } } } } Stroustrup brace breaking style: namespace a { class A { void f() { if (x) { f(); } else { g(); } } } } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
af64032b085d3711405dbe8d98f71c463e0fb52b |
|
13-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Fixes [Bug 15960] YAMLTraits doesn't roundtrip on Windows. Thanks to Kim Gräsman for help! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7c9a93ec7cea816e94a0674909c312f3d0227864 |
|
13-May-2013 |
Manuel Klimek <klimek@google.com> |
Implements UseTab for clang-format. This is required for kernel linux kernel style formatting. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c3df5ffb52cb656c3a4d0b4d70f8f28ed2390e78 |
|
13-May-2013 |
Daniel Jasper <djasper@google.com> |
Further improve optimization for nested calls. Fake parentheses (i.e. emulated parentheses used to correctly handle binary expressions) used to prevent the optimization implemented in r180264. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
07a64eca75d96ce77d1ce8cb73d1cb0877695d06 |
|
13-May-2013 |
Manuel Klimek <klimek@google.com> |
Implements IndentWidth. This is required for various styles that are for example based on 8-indent. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
04abbb2125272a9930cbaee6530e7754566d8e66 |
|
10-May-2013 |
Daniel Jasper <djasper@google.com> |
When breaking at function calls, indent from function name. Otherwise (when indenting from the wrapped -> or .), this looks like a confusing indent. Before: aaaaaaa // .aaaaaaa( // aaaaaaa); After: aaaaaaa // .aaaaaaa( // aaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
89b3a7f76ffe333aa61ab63826834883236caf96 |
|
10-May-2013 |
Daniel Jasper <djasper@google.com> |
Always format entire macro definitions. Thereby, the macro is consistently formatted (including the trailing escaped newlines) even if clang-format is invoked only on single lines of the macro. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
dd256314cf391063329e504f0ece46ee51bbfa2a |
|
10-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Config file support for clang-format, part 2. Summary: Adds actual config file reading to the clang-format utility. Configuration file name is .clang-format. It is looked up for each input file in its parent directories starting from immediate one. First found .clang-format file is used. When using standard input, .clang-format is searched starting from the current directory. Added -dump-config option to easily create configuration files. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits, jordan_rose, kimgr Differential Revision: http://llvm-reviews.chandlerc.com/D758 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
11e13801d8a25cea011c2a154380c371b6ddaaf6 |
|
08-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve line breaking in binary expressions. If the LHS of a binary expression is broken, clang-format should also break after the operator as otherwise: - The RHS can be easy to miss - It can look as if clang-format doesn't understand operator precedence Before: bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd; After: bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd; As an additional note, clang-format would also be ok with the following formatting, it just has a higher penalty (IMO correctly so). bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b2f063aeb93670c2415825be457b9e518a9fefdf |
|
08-May-2013 |
Daniel Jasper <djasper@google.com> |
Change indentation of multi-line nested name specifiers. Before: aaaaaaaa:: aaaaaaaa:: aaaaaaaa(); After: aaaaaaaa:: aaaaaaaa:: aaaaaaaa(); The reason for the change is that: a) we are not sure which is better b) it is a really rare edge case c) it simplifies the code d) it currently causes problems with memoization git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d71ec16fffd10879bf74e531d9f7fb4c5ac4eaf8 |
|
07-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Config file support for clang-format, part 1. Summary: Added parseConfiguration method, which reads FormatStyle from YAML string. This supports all FormatStyle fields and an additional BasedOnStyle field, which can be used to specify base style. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D754 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
fb59486ef3624d09896b09a978b28eb63cfd3c46 |
|
06-May-2013 |
Alexander Kornienko <alexfh@google.com> |
Added Mozilla style, cleaned get*Style methods. Summary: Patch based on a patch by Ehsan Akhgari. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D750 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7ff96ed7336b4f0efef05c10fd5ce5143918d4e1 |
|
06-May-2013 |
Daniel Jasper <djasper@google.com> |
Don't break comments after includes. LLVM/Clang basically don't use such comments and for Google-style, include-lines are explicitly exempt from the column limit. Also, for most cases, where the column limit is violated, the "better" solution would be to move the comment to before the include, which clang-format cannot do (yet). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
53e72cdcc0bc217cab33fa56858a0fe5b94ca453 |
|
06-May-2013 |
Daniel Jasper <djasper@google.com> |
Change indentation when breaking after a type. clang-format did not indent any declarations/definitions when breaking after the type. With this change, it indents for all declarations but does not indent for function definitions, i.e.: Before: const SomeLongTypeName& some_long_variable_name; typedef SomeLongTypeName SomeLongTypeAlias; const SomeLongReturnType* SomeLongFunctionName(); const SomeLongReturnType* SomeLongFunctionName() { ... } After: const SomeLongTypeName& some_long_variable_name; typedef SomeLongTypeName SomeLongTypeAlias; const SomeLongReturnType* SomeLongFunctionName(); const SomeLongReturnType* SomeLongFunctionName() { ... } While it might seem inconsistent to indent function declarations, but not definitions, there are two reasons for that: - Function declarations are very similar to declarations of function type variables, so there is another side to consistency to consider. - There can be many function declarations on subsequent lines and not indenting can make them harder to identify. Function definitions are already separated by their body and not indenting makes the function name slighly easier to find. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
fca24bc45192c254ca92ef1d7cef71a290392f31 |
|
25-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's memoization behavior. Deeply nested expressions basically break clang-format's memoization. This patch slightly improves the situations and makes expressions like aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa()))))))))))))))))))))))))))))))))))))))); work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2972d049637349bb82f52a27ad3337cf4ab769b4 |
|
25-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Add option to align escaped newlines left. This enables formattings like: #define A \ int aaaa; \ int b; \ int ccc; \ int dddddddddd; Enabling this for Google/Chromium styles only as I don't know whether it is desired for Clang/LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
94d6ad7b65b59f834bbc40e0caed5ceebca11932 |
|
24-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Flip flag to merge short if-statements into one line for Google style. This now allows clang-format to do: if (a) return; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
af8497681e38106ad6f84408e029537e2a13d79d |
|
24-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix comment alignment behavior. In the following snippet, clang-format incorrectly aligned the trailing comment, when only the last line was formatted: int aaaaaa; // comment int b; int c; // Formatting only this line moved this comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
001bf4e2bedfc6bc6a7638c098a004e4d57e308f |
|
22-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix bin-packing behavior of constructor initialziers. In Google style, constructor initializers need to be all on one line or one initializer per line if that does not fit. Without this patch, this non-bin-packing-behavior incorrectly extends to the parameters of the initializers. Before: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {} After: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
01218ffddc239a71951035d6c7698a11e323efe3 |
|
16-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Break after multiline parameters. We do this in general, but missed a few cases. Before: void aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb); After: void aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e2657dd7aa2d5a41355f56c8dbb2104c6bf60648 |
|
15-Apr-2013 |
Alexander Kornienko <alexfh@google.com> |
Fix unused variable warning with assertions disabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
70ce7881fc30a39b795b2873f008e7eca72ba669 |
|
15-Apr-2013 |
Alexander Kornienko <alexfh@google.com> |
Unified token breaking logic for strings and block comments. Summary: Both strings and block comments are broken into lines in breakProtrudingToken. Logic specific for strings or block comments is abstracted in implementations of the BreakToken interface. Among other goodness, this change fixes placement of backslashes after a block comment inside a preprocessor directive (see removed FIXMEs in unit tests). The code is far from being polished, and some parts of it will be changed for line comments support. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D665 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
1407bee187d7b964d5293ac8bf4f7a490c78cec6 |
|
11-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Change clang-format's affinity for breaking after return types. Function declarations are now broken with the following preferences: 1) break amongst arguments. 2) break after return type. 3) break after (. 4) break before after nested name specifiers. Options #2 or #3 are preferred over #1 only if a substantial number of lines can be saved by that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ac3223e45e7d17c65b143439313800eef4fdf71d |
|
10-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix labels with trailing comments and cleanup. Before: class A { public : // test }; After: class A { public: // test }; Also remove duplicate methods calculating properties of AnnotatedTokens and make them members of AnnotatedTokens so that they are in a common place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5999f7634e80daf849a036aa830fc0e4b1e03555 |
|
09-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix comments before labels. Before: switch (...) { // a // b // c case first: break; } After: switch (...) { // a // b // c case first: break; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
bf71ba2988b34c45af968f0965e28ac952e4a15f |
|
08-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Revamp indentation behavior for complex binary expressions. The idea is to indent according to operator precedence and pretty much identical to how stuff would be indented with parenthesis. Before: bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > ccccccccccccccccccccccccccccccccccccccccc; After: bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > ccccccccccccccccccccccccccccccccccccccccc; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
65622aae92ff6e338abed83d31e512ee0e013dc7 |
|
08-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Revert accidental commit r179015. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c4ff76913ada469a70ed4bd960aeff038b6c2e1b |
|
08-Apr-2013 |
Daniel Jasper <djasper@google.com> |
x git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
adc0f09585f10061007ec529451a6dd10f86fea6 |
|
05-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of multi-variable DeclStmts. This fixed llvm.org/PR15670 Before: aaaaaaaaa a = aaaaaaaaaaaaaaaaaaaa, b = bbbbbbbbbbbbbbbbbbbb, c = cccccccccccccccccccc, d = dddddddddddddddddddd; aaaaaaaaa *a = aaaaaaaaaaaaaaaaaaa, *b = bbbbbbbbbbbbbbbbbbb, *c = ccccccccccccccccccc, *d = ddddddddddddddddddd; After: aaaaaaaaa a = aaaaaaaaaaaaaaaaaaaa, b = bbbbbbbbbbbbbbbbbbbb, c = cccccccccccccccccccc, d = dddddddddddddddddddd; aaaaaaaaa *a = aaaaaaaaaaaaaaaaaaa, *b = bbbbbbbbbbbbbbbbbbb, *c = ccccccccccccccccccc, *d = ddddddddddddddddddd; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
abfc9c160ad65e890b66480f3c52e9b5ef7bf4d8 |
|
04-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug discovered with address sanitizer. Now, this works again with an empty stack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8ed9f2b25f082a1643ab5310f9eec33cf31a7577 |
|
03-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of for loops and multi-variable DeclStmts. This combines several related changes: a) Don't break before after the variable types in for loops with a single variable. b) Better indent DeclStmts defining multiple variables. Before: bool aaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa), bbbbbbbbbbbbbbbbbbbbbbbbb = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb); for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) { } After: bool aaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa), bbbbbbbbbbbbbbbbbbbbbbbbb = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb); for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3776ef3a6c333e8fb57baf09972a7450c50c9fc5 |
|
03-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Cleanup, add comments and address review comments. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178626 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3791130df5ad83e4a9872f90cc9675e90b772f88 |
|
02-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Fix some inconsistent use of indentation. Basically we have always special-cased the top-level statement of an unwrapped line (the one with ParenLevel == 0) and that lead to several inconsistencies. All added tests were formatted in a strange way, for example: Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) { } After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
81d2d38d2d774a2550fa0d2efffa707e7a53b39c |
|
01-Apr-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of function types. Before: void * (*a)(int *, SomeType *); After: void *(*a)(int *, SomeType *); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
94b748ff16172f0da2b842fe0d5bae438f07034f |
|
27-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Insert extra new line before access specifiers. Summary: Insert extra new line before access specifiers. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D581 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5262dd909a34f4c3e3f061009679fabb77b43ba4 |
|
27-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Split line comments Summary: Split line comments that exceed column limit + fixed leading whitespace handling when splitting block comments. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D577 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c363dbb204b6c77b67dfed030436643947b37cbd |
|
22-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Align comments to surrounding unformatted comments. Before: int a; // not formatted // formatting this line only After: int a; // not formatted // formatting this line only This makes clang-format stable independent of whether the whole file or single lines are formatted in most cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b64eca09dd3bcd18eb1a5cca2b123b169340bdd5 |
|
22-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Make clang-format understand more line comments. Apparently one needs to set LangOptions.LineComment. Before "//* */" got reformatted to "/ /* */" as the lexer was returning the token sequence (slash, comment). This could also lead to weird other stuff, e.g. for people that like to using comments like: //**************** git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7c22cf340995ab9107810aa39a190db3e0332294 |
|
21-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Better block comment formatting. Summary: 1. When splitting one-line block comment, use indentation and *s. 2. Remove trailing whitespace from all lines of a comment, not only the ones being splitted. 3. Add backslashes for all lines if a comment is used insed a preprocessor directive. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D557 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
92f9faf3cf1065f987f227e0c2fdf06fcccf1ae8 |
|
20-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove assertion that can be triggered on bad input. clang-format can't do anything useful, so it should leave the remainder of the line unchanged, but it should not assert/segfault. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
83a90e5e6525acdb8cc4778ed102cd3952559f15 |
|
20-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Do not consider comments when adjusting to local indent style. Before (when only reformatting "int b"): int a; // comment // comment int b; After: int a; // comment // comment int b; This also fixes llvm.org/PR15433. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
64f092865c01c72ecb9e380432e241f3af55c249 |
|
20-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Reduce penalty for breaks after "(" for functions with parameters. Before: aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f9955d309d3de328e65563baf2d34571249dccbb |
|
20-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Add extra indentation for multiline comparisons. This seems to be generally more desired. Before: if (aaaaaaaa && bbbbbbbb > cccccccc) {} After: if (aaaaaaaa && bbbbbbbb > cccccccc) {} Also: Some formatting cleanup on clang-format's files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
052685c170fcc4fa057c68a44425e6d9b945a167 |
|
19-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Split long lines in multi-line comments. Summary: This is implementation for /* */ comments only. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3af59ce065310fd3d0820a6e2644d4ca688be810 |
|
15-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of chained calls. clang-format already prevented sequences like: ... SomeParameter).someFunction( ... as those are quite confusing. This failed on: ... SomeParameter).someFunction(otherFunction( ... Fixed in this patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1fdd8b351e28ee175157e61dac1b3f62b79b7a62 |
|
15-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Indent all lines in a multi-line comment by the same amount. Summary: Do this to avoid spoling nicely formatted multi-line comments (e.g. with code examples or similar stuff). Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D544 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f753615897c86928517e48e4d106e669d59618c5 |
|
14-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Multi-line comment alignment Summary: Aligns continuation lines of multi-line comments to the base indentation level +1: class A { /* * test */ void f() {} }; The first revision is work in progress. The implementation is not yet complete. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
923ebef120a37122ce50722a85cbe42c0c2dab53 |
|
14-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Basic support for formatting asm() statments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6050a1e53aa3cd3b21d65d440413af5a5ac1d466 |
|
13-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Fix comment indentation before labels. Before: switch (x) { // if 1, do f() case 1: f(); } After: switch (x) { // if 1, do f() case 1: f(); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e74de28ec3692986f3467a7f160a0e293277fa7e |
|
13-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Added AnnotatedToken::isOneOf + a few other refactorings Summary: <subj> Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D536 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6f21a988990ff5872822dcb049bd8fc65ce3d236 |
|
13-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of new arrays of pointers. Before: A = new SomeType * [Length]; A = new SomeType *[Length](); After: A = new SomeType *[Length]; A = new SomeType *[Length](); Small formatting cleanups with clang-format. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
aa62d0c4fc9449d4c438fe200ef329b067c037c7 |
|
08-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Fixes breaking of string literals. 1. We now ignore all non-default string literals, including raw literals. 2. We do not break inside escape sequences any more. FIXME: We still break in trigraphs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f302354a7d1a63186fb0d9aa600ce3257be1f690 |
|
07-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove unncessary whitespace when triggered on empty line. With the cursor located at "I", clang-format would not do anything to: int a; I int b; With this patch, it reduces the number of empty lines as necessary, and removes unnecessary whitespace. It does not change/reformat "int a;" or "int b;". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0090591e505637cf2d9ea3b45768334d78d24ca2 |
|
04-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Make sure to not split string literals at the first character. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
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/Format.cpp
|
248497199bc56e86d1c089beb9529f3b3d77abb1 |
|
01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Normal indent for last element of builder-type call. In builder type call, we indent to the laster function calls. However, for the last element of such a call, we don't need to do so, as that normally just wastes space and does not increase readability. Before: aaaaaa->aaaaaa->aaaaaa( // break aaaaaa); aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa ->aaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaa->aaaaaa->aaaaaa( // break aaaaaa); aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
812c045e591495b940f5a9102b146bb43b970e1f |
|
01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove trailing whitespace of line comments. This fixed llvm.org/PR15378. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
bc30c71d20f05bc39b5dd73f06ee4dede9c55710 |
|
01-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Implements breaking string literals at slashes. We now break at a slash if we do not find a space to break on. Also fixes a bug where we would go over the limit when breaking the second line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176350 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
af31fd7021e685280da9155e5017f1053b05fdf8 |
|
01-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Implement fallback split point for string literals. If we don't find a natural split point (currently space) in a string literal protruding over the line, we just split at the last possible point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a4d4621b206f941cc58d9d0bc7c67a8e705c9d49 |
|
28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of #defines. Two improvements: 1) Always leave at least one space before "\". Otherwise is can look bad and there is a risk of unwillingly joining to characters to a different token. 2) Use the full column limit for single-line #defines. Fixes llvm.org/PR15148 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b6f02f3bcb5ddcd7c7f1a3571d554fe55c72968f |
|
28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug when formatting "A<A<A>>". Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaa); Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3a39ac7cee044cf7d9b524b529a97d5f075ee695 |
|
28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix incorrect recognition of bin-packing. Before (in Google style): Constructor() : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa( aaaaaa) {} After: Constructor() : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
faab0d35da240bde26a6281ed1cfa14c44585a5a |
|
27-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Enable bin-packing in Google style. After some discussions, it seems that this is the better path in the long run. Does not change Chromium style, as there, bin packing is forbidden by the style guide. Also fix two minor bugs wrt. formatting: 1. If a call parameter is a function call itself and is split before the "." or "->", split before the next parameter. 2. If a call parameter is string literal that has to be split onto two lines, split before the next parameter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1ef81d57fbcc26080c98e140e7c82db6d2aeba87 |
|
26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Only keep empty lines in unwrapped lines if they preceed a line comment. Empty lines followed by line comments are often used to highlight the comment. Empty lines somewhere else are usually left over from manual or automatic formatting and should probably be removed. Before (clang-format would keep): S s = { a, b }; After: S s = { a, b }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0fb382bfbfbfee73763a213b2257042ed342c4b0 |
|
26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Only break string literals as a last resort. We might want to move towards doing this if the formatting can be significantly improved, but we need to carefully evaluate the different situations first. Before (the string literal was split by clang-format here): aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa " "aaaaa aaa aaa aaaaaa")); After: aaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa aaaaa aaa aaa aaaaaa")); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9c3e71acb53a67f305a54f3d6d6decb143acaae4 |
|
25-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Re-add hack that caused regression. This fixes llvm.org/PR15350. Before: Constructor(int Parameter = 0) : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa), aaaaaaaaaaaa(aaaaaaaaaaaaaaaaa) {} After: Constructor(int Parameter = 0) : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa), aaaaaaaaaaaa(aaaaaaaaaaaaaaaaa) {} I think the correct solution is to put the VariablePos into ParenState, not LineState. Added FIXME. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3c08a818a6ac9115fe8880af9bbf5a0a87bdffaa |
|
24-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking between a type and name in variable declarations. This fixes llvm.org/PR14967 and is generall necessary to avoid situations where the column limit is exceeded. The challenge is restricting such lines splits, otherwise clang-format suddenly starts breaking at bad places. Before: ReallyLongReturnType<TemplateParam1, TemplateParam2> ReallyReallyLongFunctionName( const std::string &SomeParameter, const SomeType<string, SomeOtherTemplateParameter> &ReallyReallyLongParameterName, const SomeType<string, SomeOtherTemplateParameter> &AnotherLongParameterName) {} After: ReallyLongReturnType<TemplateParam1, TemplateParam2> ReallyReallyLongFunctionName( const std::string &SomeParameter, const SomeType<string, SomeOtherTemplateParameter> & ReallyReallyLongParameterName, const SomeType<string, SomeOtherTemplateParameter> & AnotherLongParameterName) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
237d4c1c785be13656bff6c09e5b7ccd066ff5ba |
|
23-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Better formatting of conditional expressions. In conditional expressions, if the condition is split over multiple lines, also break before both operands. This prevents formattings like: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? b : c; Which are bad, because they suggestion incorrect operator precedence: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? b : c); This lead to the discovery that the expression parser incorrectly handled conditional operators and that it could also handle semicolons (which in turn reduced the amount of special casing for for-loops). As a side-effect, we can now apply the bin-packing configuration to the sections of for-loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f11a705c6075b12cbae5632ba4de433bc9bc105f |
|
21-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Consistently put {} onto the same line for empty functions. This fixes llvm.org/PR15167. Before: LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL() : AAAAAAAA(10), BBBBBBBBB(10) { } LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL() : AAAAAAAA(10) {} After: LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL() : AAAAAAAA(10), BBBBBBBBB(10) {} LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL() : AAAAAAAA(10) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7d81281fc39f6d40d86be6600adba13c05b4a639 |
|
21-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking between type and name in for loops. This fixes llvm.org/PR15033. Also: Always break before a parameter, if the previous parameter was split over multiple lines. This was necessary to make the right decisions in for-loops, almost always makes the code more readable and also fixes llvm.org/PR14873. Before: for (llvm::ArrayRef<NamedDecl *>::iterator I = FD->getDeclsInPrototypeScope() .begin(), E = FD->getDeclsInPrototypeScope().end(); I != E; ++I) { } foo(bar(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccc), d, bar(e, f)); After: for (llvm::ArrayRef<NamedDecl *>::iterator I = FD->getDeclsInPrototypeScope().begin(), E = FD->getDeclsInPrototypeScope().end(); I != E; ++I) { } foo(bar(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccc), d, bar(e, f)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e9a6226c7a2fd1c30a00990cdeb69b89f5599fb3 |
|
20-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Fix regression in string literal alignment. Now correctly indents (again): a = a + "a" "a" "a"; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b56b6d1bd6f41d7b944a9631a9ab481cafe6535b |
|
20-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Fixes bug in string literal alignment. We now indent the following correctly: 1. some + "literal" /* comment */ "literal"; 2. breaking string literals after which we have another string literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c4615b7aaf97e303a4fc675956f7f5572d492885 |
|
20-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Don't remove blank lines within unwrapped lines. If the code author decides to put empty lines anywhere into the code we should treat them equally, i.e. reduce them to the configured MaxEmptyLinesToKeep. With this change, we e.g. keep the newline in: SomeType ST = { // First value a, // Second value b }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8092a940922f307edb569036a3bb6bb722fb3a3d |
|
20-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Implements breaking of string literals if they stick out. An alternative strategy to calculating the break on demand when hitting a token that would need to be broken would be to put all possible breaks inside the token into the optimizer. Currently only supports breaking at spaces; more break points to come. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d78967088c02b69166810cffae5471bccea91ca3 |
|
19-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug in LineState comparison function. The key bug was if (Other.StartOfLineLevel < StartOfLineLevel) .. instead of if (Other.StartOfLineLevel != StartOfLineLevel) .. Also cleaned up the function to be more consistent in the comparisons. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
82282dc907a04b1931f8f578693b035ad751fd3b |
|
18-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve indentation of builder type calls. In builder-type calls, it can be very confusing to just indent parameters from the start of the line. Instead, indent 4 from the correct function call. Before: aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break aaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()->aaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) ->aaaaaaaaaaaaaaaaa(); After: aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break aaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa() ->aaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) ->aaaaaaaaaaaaaaaaa(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
29333160cfd863a451ddb6fd505c3619c3724c95 |
|
18-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Reformat lines if they were "moved around". An unwrapped line can get moved around if there is no newline before it and the previous line was formatted. Example: template<typename T> // Cursor is on this line when hitting "format" T *getFETokenInfo() const { return static_cast<T*>(FETokenInfo); } "return .." is the second unwrapped line in this scenario. I does not touch any reformatted region. Thus, the result of formatting is: template <typename T> T *getFETokenInfo() const { return static_cast<T *>(FETokenInfo); } After second format (and arguably desired end-result): template <typename T> T *getFETokenInfo() const { return static_cast<T *>(FETokenInfo); } This fixes: llvm.org/PR15060. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
66d19bdeef25611c9188b3f27b7d578df4b9a447 |
|
18-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Always break after multi-line string literals. Otherwise, other parameters can be quite hidden. Reformatted unittests/Format/FormatTest.cpp after this. Before: someFunction("Always break between multi-line" " string literals", and, other, parameters); After: someFunction("Always break between multi-line" " string literals", and, other, parameters); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cf5767d65a0ee64b22c242eb758e8684a6ea5a59 |
|
18-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Prevent line breaks that make stuff hard to read. Before: aaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa) .aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa) .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b130a54940171a95422a20a07ee8fdfe009806a5 |
|
15-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Re-enable ConstructorInitializerAllOnOneLineOrOnePerLine option. This got lost and was untested as the same effect is achieved by avoiding bin packing, which is active in Google style by default. However, moving forward, we want more control over the bin packing option(s) and thus, this flag should work as expected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7878a7bdebceaa8d8a893abb295027cde619e467 |
|
15-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Prevent only breaking before "?" in conditional expressions. This is almost always more readable. Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaa; After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
fc75908a7f58903a92c47e1ae02f9a05c36c9f59 |
|
14-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Reduce penalty for breaking before ./-> after complex calls. This gives a clearer separation of the context, e.g. in GMOCK statements. Before: EXPECT_CALL(SomeObject, SomeFunction(Parameter)).WillRepeatedly(Return(SomeValue)); After: EXPECT_CALL(SomeObject, SomeFunction(Parameter)) .WillRepeatedly(Return(SomeValue)); Minor format cleanups. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c78c6b35d398b4c9414e7c5c7e413e28a66c8c5f |
|
14-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Remove the trailing whitespace of formatted lines. So far, clang-format has always assumed the whitespace belonging to the subsequent token. This has the negative side-effect that when clang-format formats a line, it does not remove its trailing whitespace, as it belongs to the next token. Thus, this patch fixes most of llvm.org/PR15062. We are not zapping a file's trailing whitespace so far, as this does not belong to any token we see during formatting. We need to fix this in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c5cfa490a1fa4eb1a3a17803c6125b42abd73455 |
|
14-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Get less confused by trailing comma in Google style. The formatter can now format: void aaaaaaaaaaaaaaaaaa(int level, double *min_x, double *max_x, double *min_y, double *max_y, double *min_z, double *max_z, ) { } Although this is invalid code, it frequently happens during development and clang-format should be nicer :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6cabab48dacc1317821f8f078ed2d4c603b67aff |
|
14-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Align superclasses for multiple inheritence. This fixes llvm.org/PR15179. Before: class ColorChooserMac : public content::ColorChooser, public content::WebContentsObserver { }; After: class ColorChooserMac : public content::ColorChooser, public content::WebContentsObserver { }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a03ab10f0e4d888139b3b694dd55d176982f72a4 |
|
13-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking after the return type in function declarations. This has so far been disabled for Google style, but should be done before breaking at nested name specifiers or in template parameters. Before (in Google style): template <typename T> aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaa< T>::aaaaaaa() {} After: template <typename T> aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaa() {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
42f458d164cbbee23e55e874b6cee7026ca721ca |
|
13-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix comment alignment close to the column limit. Due to an error in one of the expressions, we used to not align comments although it would have been possible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
62a48fbb891267873a71e1147d39200363a49276 |
|
13-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Pull search state out as class members. Fix some comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
32a2fd7631026f2fe248381546c5e6149f4f95ee |
|
13-Feb-2013 |
Manuel Klimek <klimek@google.com> |
An attempt to make the search algorithm easier to understand. - clear ownership: the SpecificBumpPtrAllocator owns all StateNodes - this allows us to simplify the memoization data structure into a std::set (FIXME: figure out whether we want to use a hash based data structure). - introduces StateNode as recursive data structure, instead of using Edge and the Seen-map combined to drill through the graph - using a count to stabilize the penalty instead of relying on the container - pulled out a method to forward-apply states in the end This leads to a ~40% runtime decrease on Nico's benchmark. Main FiXME is that the parameter lists of some function get too long. I'd vote for either pulling the Queue etc into the Formatter proper, or creating an inner class just for the search algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9ece2bb8499251f3e7cdf65e7a65b38aaeead0d8 |
|
12-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug in the adjustment to existing lines. Before (if only the second line was reformatted): void f() {} void g() {} After: void f() {} void g() {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591a |
|
11-Feb-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Detect ObjC message expressions after 'in' in loop Before: for (id foo in[self getStuffFor : bla]) { } Now: for (id foo in [self getStuffFor:bla]) { } "in" is treated as loop keyword if the line starts with "for", and as a regular identifier else. To check for "in", its IdentifierInfo is handed through a few layers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
729a743b317d877df3978e88a4a247d2edbf2090 |
|
11-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix invalid formatting with spaces before trailing comments. In google style, trailing comments are separated by two spaces. This patch fixes the counting of these spaces and prevents clang-format from creating a line with 81 columns. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
52635ff9fb530dfdfc6a94e52a2270bf1bb8346b |
|
08-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Fix indentation-detection at indent level 0. This correctly formats: { a; } where { is incorrectly indented by 2, but is at level 0, when reformatting only 'a;'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
547d5db5ed482e23edf62130ffdee86ba810d432 |
|
08-Feb-2013 |
Manuel Klimek <klimek@google.com> |
Takes the context into account when re-indenting regions. Fixes llvm.org/PR14916. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
29f123b2fa0435bb1962f0d9e9a2e660f35fbb2f |
|
08-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Implement a tiny expression parser to improve formatting decisions. With this patch, the formatter introduces 'fake' parenthesis according to the operator precedence of binary operators. Before: return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA || bbbb & BBBBBBBBBBBBBBBBBBBBBBBBBBBBB || cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC || dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD; f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa); After: return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA || bbbb & BBBBBBBBBBBBBBBBBBBBBBBBBBBBB || cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC || dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD; f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa); Future improvements: - Get rid of some of the hacky ways to nicely format certain constructs. - Merge this parser and the AnnotatingParser as we now have several parsers that analyze (), [], etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ce3d1a68d98f8a557ba5a5391cae8278ae6f29d2 |
|
08-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Avoid unnecessary line breaks in nested ObjC calls. Before: [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)] forType:kBookmarkButtonDragType]; After: [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)] forType:kBookmarkButtonDragType]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
474e46211a141e4566c399b80ae26e3580b70c90 |
|
06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug in the alignment of comments. Before: const char *test[] = { // A "aaaa", // B "aaaaa", }; After: const char *test[] = { // A "aaaa", // B "aaaaa", }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
15417ef20e3cda668351c67cc580587913f6bee8 |
|
06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Align trailing block comments like trailing line comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9e9e6e0297a96e237b53e6be433749065bcea5f8 |
|
06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of ObjC method calls. This fixes llvm.org/PR15165. We now correctly align: [image_rep drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0 ssssssssdd:NO hints:nil]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
36ba0ff4b632cff7424693b9818bcc8d9ea7798a |
|
06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix a formatting bug caused by comments in expressions. This fixes llvm.org/PR15162. Before: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174508 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8ff690ab478b33e0d830a6203de12d191d94f8ff |
|
06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Optionally derive formatting information from the input file. With this patch, clang-format can analyze the input file for two properties: 1. Is "int *a" or "int* a" more common. 2. Are non-C++03 constructs used, e.g. A<A<A>>. With Google-style, clang-format will now use the more common style for (1) and format C++03 compatible, unless it finds C++11 constructs in the input. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
63d7cedca8616921c1908c88c2f23fcd67bbab99 |
|
05-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for formatting ObjC method declarations/calls. We can now format stuff like: - (void)doSomethingWith:(GTMFoo *)theFoo rect:(NSRect)theRect interval:(float)theInterval { [myObject doFooWith:arg1 // name:arg2 error:arg3]; } This seems to fix everything mentioned in llvm.org/PR14939. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d399bfff5a57325d8e63116c70aa727b1fb43232 |
|
05-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix some linebreak decisions in Google format. Before: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)); After: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cda165056890b8ccfc6e2897c711388c5fb518c0 |
|
04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of trailing block comments This is a follow up to r174309 to actually make it work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2752ff35854b295837b8088e44d5a932be60e107 |
|
04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of trailing block comments. We can now (even in non-bin-packing modes) format: someFunction(1, /* comment 1 */ 2, /* comment 2 */ 3, /* comment 3 */ aaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8159d2f271c9142b46a672ac2c45821911171a7d |
|
04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix an error in formatting of for-loops. Two minor changes: * Slight penalty for breaking at "," as opposed to ";". * Don't apply bin-packing rules to for-loops. Before: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} After: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0178673f541685cf5067814dfeee2644078e39a9 |
|
04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Restructuring of token annotation for formatting. This combines several changes: * Calculation token type (e.g. for * and &) in the AnnotatingParser. * Calculate the scope binding strength in the AnnotatingParser. * Let <> and [] scopes bind stronger than () and {} scopes. * Add minimal debugging output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6bd0232b4f58e7ad40f687b09b0eb897bcc3fd1e |
|
03-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug in formatting of nested initializers. We can now format: SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } }, { { 111111111111111111111111111111, 222222222222222222222222222222, 333333333333333333333333333333 } }, { { 1, 2, 3 } }, { { 1, 2, 3 } } }; Before, we did strange things there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
67581942138bb5ce25bcf3a67fff278ca4fa5f7d |
|
01-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Hopefully fix windows build due to non-standard pair implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174169 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
68ef0df17ed6de26084c3a11a4cabbd69a5a2465 |
|
01-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Revamp of the basic layouting algorithm in clang-format. In order to end up with good solutions, clang-format needs to try "all" combinations of line breaks, evaluate them and select the best one. Before, we have done this using a DFS with memoization and cut-off conditions. However, this approach is very limited as shown by the huge static initializer in the attachment of llvm.org/PR14959. Instead, this new implementation uses a variant of Dijkstra's algorithm to do a prioritized BFS over the solution space. Some numbers: lib/Format/TokenAnnotator.cpp: 1.5s -> 0.15s Attachment of PR14959: 10min+ (didn't finish) -> 10s No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f343cabb68d495041706b8e2f1ed48fbac3cba06 |
|
31-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Several improvements to the formatting of static initializers. 1. Never avoid bin packing in static initializers as this can lead to terrible results. 2. If an element has to be broken over multiple lines, break after the following comma. This should be a step forward, but there are still many cases especially with nested static initializers that we handle badly. More patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
afcbd859f839db4133311147c1bc7db29dfaea10 |
|
30-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't generate no-op replacements. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
d4f2c2e21addd8ed0a50b92f062d3229cde0506a |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of code with comments. Before: aaaaaaa(aaaaaa( // comment aaaaaaa)); <big mess> After: aaaaaaa(aaaaaa( // comment aaaaaaaa)); function(/* parameter 1 */ aaaaaaa, /* parameter 2 */ aaaaaaa, /* parameter 3 */ aaaaaaa, /* parameter 4 */ aaaaaaa); (the latter example was only wrong in the one-arg-per-line mode, e.g. in Google style). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f1579605adf03f94a2ddddc95c764737ead0efe5 |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow all parameters on next line for function calls in Chrome. The style guide only forbids this for function declarations. So, now someFunction( aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaa); Is allowed in Chromium mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f40fb4beaa22b4e53cd8b5319836b361ebfa6c62 |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Split ">>" in "A<B<C> >" in Chromium style. It needs to be compatible with C++03. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b3109e35d75a543d167906384347c017812e5dbf |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix uninitialized error caused by r173801. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
adc6aba07293928122629e9d8a91a37144254831 |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Calculate the split penalty upfront. This is a) More efficient. b) Important as we move forward with further metrics for penalty. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1a1ce8330ba3248e36615adef3759ad22fc18c8d |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a comment and reformat clang-format with clang-format Not all changes might be ideal, but IMO all are acceptable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2e60377273fb451587a60209997148480754b9fa |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for multiple variable declarations. Before: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); After: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
93384a910cb98f3a128b76e6043f149e1b384c65 |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Reverting changes from r173785 (removing empty lines before "}"). This needs some more thinking, e.g. for namespaces, chains of if-else if, ... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8df364fc0b3d89fb4ea632c6824a121a8c7752a5 |
|
29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Remove empty lines before "}". Those empty lines waste vertical whitespace and almost never increase readability. Before: void f() { DoSomething(); } After: void f() { DoSomething(); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7522318ce2b2280dc679b62a4193c8f179632c16 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a bug that would lead to bad line break decisions in for loops. Before: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {} After: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d75ff6496bfb599a9edde41681873919d4d44152 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't put a function's return type on its own line in Google style. This would be against the style guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declarations_and_Definitions#Function_Declarations_and_Definitions Not sure what to do as a last resort if the function signature does not fit onto a single line in Google style .. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
83f25ba0499f18b91501fb6538c49ebc7827bea0 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let clang-format break after a function's return type. Before: TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) {} After: TypeSpecDecl * TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) {} This fixes llvm.org/PR14717. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
02b771e3110f7799f93d5d17dc6fefc5713387c3 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Make continuations in constructor initializers consistent. Before: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {} After: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3b9a8fc5bee5434bebc9058646896423adac625b |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for formatting range-based for-loops. Before (in good cases): for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {} After: for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173684 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
bfe6fd4f00257b113ea3bcb4efef8d9f9f245882 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of conditional expressions. Before we did not really systematically format those. Now, we format the different cases as: - 1 Line: a ? b : c; - 2 Lines: short ? loooooooooong : loooooooooong - 2 Lines: loooooooooooooooong ? short : short - 3 Lines: loooooooooooooooong ? loooooooooooooong : loooooooooooooong Not sure whether "?" and ":" should go on the new line, but it seems to be the most consistent approach. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ae8699bde649e2ed1f66414b4283b862f11056dd |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Several small changes in formatting decisions. 1. Use a hanging ident for function calls nested in binary expressions. E.g.: int aaaaa = aaaaaaaaa && aaaaaaaaaa( aaaaaaaaaa); 2. Slightly improve heuristic for builder type expressions and reduce penalty for breaking before "." and "->" in those. 3. Remove mostly obsolete metric of decreasing indent level. This fixes: llvm.org/PR14931. Changes #1 and #2 were necessary to keep tests passing after #3. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5f2173ee723fd17b758f2a35a5bb39ca74eca523 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve indentation after breaking at nested name specifiers. These always represent a continuation and we should increase the ident. Before: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
986e17ff3bd3df2762f88569cab3fdfbabc08bb1 |
|
28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Avoid confusing identations for multi-parameter functions. Before: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa); After: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3499ddac3f075cbda6347067190fcc7a972dcaca |
|
25-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix some alignment and line break decisions. This combines two small changes: 1) Put a penalty on breaking after "<" 2) Only produce a hanging indent when parameters are separated by commas. Before: aaaaaaaaaaaaaaaaaaaaaaaa< aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); After: aaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); This changes one ObjC test, but AFAICT this is not according to any style guide (neither before nor after). We probably should be aligning on the ":" there according to: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=Method_Invocations#Method_Invocations git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
63f003644420fff0ea3d463e68aee83f2f5842cd |
|
25-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking after "::" if absolutely necessary. Otherwise, really long nested name specifiers can easily lead to a violation of the column limit. Not sure about the rules for indentation in those cases, so input is appreciated (see tests.). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e438bac04165937036e41c321fa0d5567d1e520c |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add extra indent for nested calls inside if's. Before: if (aaaaaaaaaa( aaaaaaaaaa)) {} After: if (aaaaaaaaaa( aaaaaaaaaa)) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f39c8859b087151617aa2c8b193d0b332503e3ca |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't try to align builder-type continuations on assignments. Before: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); After: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); The other indent is just wrong and confusing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
13cb7c2c46bca6f52fd217091ef2922a3eca46f5 |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't try to do a hanging ident after assignments. Before: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); After: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); The other indentation was a nice attempt but doesn't work in many cases. Not sure what the right long term solution is as the "After: " is still not nice. We either need to figure out what to do in the cases where it "doesn't work" or come up with a third solution, e.g. falling back to: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); which should always work and nicely highlight the structure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
20d3583857c2cc99dcc9c27ff5f23916df9c0812 |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix the formatting of pointer/reference types in range-based for loops. Before: for (int & a : Values) {} After: for (int &a : Values) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7006e7ebc0098b7627bd3cc13367ea576c25dcbb |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Removing the penalty for breaking after "=". Having seen more cases, this actually was not a good thing to do in the first place. We can still improve on what we do now, but breaking after the "=" is good in many cases. Before: aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa)); After: aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4bfc65aab5408f76dfe38e3f4e4375fadeda3bc3 |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix another regression for pointer types. Before: if (int * a = &b) ... After: if (int *a = &b) ... Also changed all the existing tests to test the expressions in question both in a declaration and in an expression context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
218b6dfaee321cec558e15d47b68155dd9f35684 |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix regression in formatting pointer types. We will need a more principled solution, but we should not leave this unfixed until we come up with one. Before: void f() { int * a; } After: void f() { int *a; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
092a2c7373c02d1653bea1feb1ada05363b02bc2 |
|
23-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fix segfaults in the formatter. Also: expletive deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8f4bd7a20f89d9065bebadd270e6bc7822257d37 |
|
23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add option to allow putting all parameters onto the next line. This only affects styles where BinPackParameters is false. With AllowAllParametersOnNextLine: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa); Without it: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
3298327e0e6ecb31ca8f3d0996043292e7c860f2 |
|
22-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let the formatter be more restrictive for breaking around . and -> Before: aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa) .aaaaaaaaaaaaaaaaaa(); After: aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ffee17126e10a0e2febfcfbf61d8e0d6e2fcf4c0 |
|
22-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix "*" formatting when creating arrays of pointers. Before: A = new int * [10](); After: A = new int *[10](); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
821627e5865c29357aef0e4f175b0abd083bf191 |
|
21-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Remove "incorrect" aligning of trailing comments. We used to align trailing comments belong to different things. Before: void f() { // some function.. } int a; // some variable.. After: void f() { // some function.. } int a; // some variable.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
05bf827fb8c0812e14d287c24e6f0a0b8e64377e |
|
21-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Set MatchingParen for [], to match <>, (), {}. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3f29fbb9d86dc58730bbfcdd26dc6ee6a401cbd4 |
|
21-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Rename LSquare to Left to make parseSquare() more consistent with the other paren parsing methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
032f25329565adfc542f001953565091eccba130 |
|
21-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix parsing of templated declarations. Before: template <template <typename T>, typename P > class X; After: template <template <typename T>, typename P> class X; More importantly, the token annotations for the second ">" are now computed correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9c8c40e7334a59159392d020dd4339b86326ec00 |
|
21-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug discovered by valgrind. When trying to merge lines, we should not touch lines that are invalid, as we don't know how long they might be. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4c1281283513ff5cd37ee224639e2f3853ec9ea8 |
|
18-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fixes issues around pulling in the next line in simple if statements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c79afdae8a2e12d1e8f27a2ae0a43dfca3b8283b |
|
18-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Reduce penalty for splitting between ")" and ".". ').' is likely part of a builder pattern statement. This is based upon a patch developed by Nico Weber. Thank you! Before: int foo() { return llvm::StringSwitch<Reference::Kind>(name).StartsWith( ".eh_frame_hdr", ORDER_EH_FRAMEHDR).StartsWith( ".eh_frame", ORDER_EH_FRAME).StartsWith(".init", ORDER_INIT).StartsWith( ".fini", ORDER_FINI).StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT); } After: int foo() { return llvm::StringSwitch<Reference::Kind>(name) .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR) .StartsWith(".eh_frame", ORDER_EH_FRAME) .StartsWith(".init", ORDER_INIT).StartsWith(".fini", ORDER_FINI) .StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT); } Probably not ideal, but makes many cases much more readable. The changes to overriding-ftemplate-comments.cpp don't seem better or worse. We should address those soon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7d1185de4405637094d64f960f2b6d01f8bce04e |
|
18-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Also align trailing line comments in include directives. Before: #include <a> // for x #include <a/b/c> // for yz After: #include <a> // for x #include <a/b/c> // for yz git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
dcc2a6269ba86285b20ee76487807b9cd20cefbe |
|
18-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let the formatter align trailing line comments where possible. Before: int a; // comment int bbbbb; // comment After: int a; // comment int bbbbb; // comment git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
6a21a556a728325e1fae4387128d149927a4fbff |
|
18-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: The contents of @selector() should be formatted as a selector. Before: @selector(foo: ) Now: @selector(foo:) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5096a44f2ec5ab9e5b801424e04919f4fcf29f1d |
|
17-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Get bit tests in ifs right. It's generally not possible to know if 'a' '*' 'b' is a multiplication expression or a variable declaration with a purely lexer-based approach. The formatter currently uses a heuristic that classifies this token sequence as a multiplication in rhs contexts (after '=' or 'return') and as a declaration else. Because of this, it gets bit tests in ifs, such as "if (a & b)" wrong. However, declarations in ifs always have to be followed by '=', so this patch changes the formatter to classify '&' as an operator if it's at the start of an if statement. Before: if (a& b) if (int* b = f()) Now: if (a & b) if (int* b = f()) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
60ca75d4d1878f8a45799316f462d4d0114238b4 |
|
17-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking after the trailing const after a function declaration. Before: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const GUARDED_BY( aaaaaaaaaaaaa); After: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const GUARDED_BY(aaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2c6cc48a38455969b4602a2d37ce620101b7eebc |
|
17-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of comments in static initializers. Also adding more tests. We can now keep the formatting of something like: static SomeType type = { aaaaaaaaaaaaaaaaaaaa, /* comment */ aaaaaaaaaaaaaaaaaaaa /* comment */, /* comment */ aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, // comment aaaaaaaaaaaaaaaaaaaa }; Note that the comment in the first line is handled like a trailing line comment as that is likely what the user intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172711 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
aab60054553c35f6761cf96f3476997f250f1f4a |
|
17-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Revert most of r172140. r172140 changed the formatter to produce "-(id) foo" instead of "- (id)foo" in google style, with a link to http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions as reference. But now that I look at that link again, it seems I didn't read it very carefully the first time round. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
16618240a8a28d84de6d950f89145a78645e26e7 |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a bug where we would move a following line into a comment. Before: Constructor() : a(a), // comment a(a) {} After: Constructor() : a(a), // comment a(a) {} Needed this as a quick fix. Will add more tests for this in a future commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1f2b07898f66524fd7fe1b177fb0d7c58016e93b |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix parsing error in conditional expressions. We used to incorrectly parse aaaaaa ? aaaaaa(aaaaaa) : aaaaaaaa; Due to an l_paren being followed by a colon, we assumed it to be part of a constructor initializer. Thus, we never found the colon belonging to the conditional expression, marked the line as bing incorrect and did not format it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
48bd7b72b8911147ec9bdeaa8ebb211543fd23a9 |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve understanding of unary operators. Before: int x = ** a; After: int x = **a; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
df3736aa70443ac0f33af094989b4ba88d73f568 |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Disable inlining of short ifs in Google style. Various reasons seem to speak against it, so I am disabling this for now. Changed tests to still test this option. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172618 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
0df6acdf4f6faf7579775a739e1c09448c076c0f |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add option to avoid "bin-packing" of parameters. "Bin-packing" here means allowing multiple parameters on one line, if a function call/declaration is spread over multiple lines. This is required by the Chromium style guide and probably desired for the Google style guide. Not making changes to LLVM style as I don't have enough data. With this enabled, we format stuff like: aaaaaaaaaaaaaaa(aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172617 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
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/Format.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/Format.cpp
|
6b825c2e1e691deca41c6f979164b5d20c203593 |
|
16-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Never merge < and ::, as it produces different tokens. Before: vector<::Type> t; After: vector< ::Type> t; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
55b08e769f05987942c307fde8eb168df01e504f |
|
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(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
19132303666ca434aefae2e725d76f9c57336e44 |
|
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 implicit string literal. All our state is not made for handling that anyway, so we'll revisit this if we find a problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
407a31afffc936291d719665b9edb72532c0ed3b |
|
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 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b369c2cb31358f749b9ced97440a6c457f38eaae |
|
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; After: int a = /**/ -1; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2c7739e3cbf1357c0ef8d894045a300331053565 |
|
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, 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6f5bb2c93c31a7977382c5079d85db8ca3267cd0 |
|
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
fd0ca976bd55167364ba1178e884d275cc6ef30b |
|
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2b9c10bd8f80c004756308a5163fa7eda27eb5ce |
|
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" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172424 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e0b15ea7edeceb41decddfeabaf6fac935ed7baf |
|
14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Put simple preprocessor directives on a single line. Before: #define A \ A After: #define A A git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
feb18f5ff2cfa952fec4e751eb9665706c4674af |
|
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 parameter as we go along. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
995e8207877f6f5c8ed7d63f9b61e156dd171e50 |
|
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 class solely used for communicating between the UnwrappedLineParser and the Formatter. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4abbb535f0f050aea6373e26e769643c3c61a9b1 |
|
14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve understanding post increment and decrement. Before: (a->f()) ++; a[42] ++; After: (a->f())++; a[42]++; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a4ae9f30ef7bccdaa3feef8036af07fbb91f107c |
|
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(). Reviewers: klimek, djasper Reviewed By: djasper CC: cfe-commits, thakis, rafael.espindola Differential Revision: http://llvm-reviews.chandlerc.com/D290 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
487f64b2ae3f991216eb1346a62ea18156f0b519 |
|
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 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> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4e9008ac62b4c403c5c30724953664dcbb03d02e |
|
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,(b)); After: function(a, (b)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8134e1e575f862799c361b9c146eae7672010fa0 |
|
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> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172350 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4981bd0ca215570ef1e2e1c1c64a2c399069dc42 |
|
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 *) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cd458330d0cdced36a49f1d66cd9c5908f46d939 |
|
13-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]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ea86563962102149609f6442491d884bc337a175 |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove debugging junk I accidentally landed in r172333. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e8ccc81a9f66361450148338b8457dd2c6ad11de |
|
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:NSBackingStoreBuffered defer:YES])) { Now: if ((self = [super initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES])) { git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
b14d1cae88b7966da5112ea58009140d49a0fb2d |
|
12-Jan-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove unused private field. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b312314cd7aaf8a4c3902aa28c8bc0a9662a8e9b |
|
12-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix incorrect comparison operator causing loooong formatting times. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f681fa8238b82822a3d939f0e4df80660666f8b1 |
|
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 cannot be set. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
774b97312ddffe64435a1428f904211ee46cf289 |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove a redundant CurrentLineType check. The containing if checks for this already. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
bcfdd263b79c766db9154b009bd831ef83090c83 |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Initial support for formatting Objective-C method expressions. This follows the approach suggested by djasper in PR14911: When a '[' is seen that's at the start of a line, follows a binary operator, or follows one of : [ ( return throw, that '[' and its closing ']' are marked as TT_ObjCMethodExpr and every ':' in that range that isn't part of a ternary ?: is marked as TT_ObjCMethodExpr as well. Update the layout routines to not output spaces around ':' tokens that are marked TT_ObjCMethodExpr, and only allow breaking after such tokens, not before. Before: [self adjustButton : closeButton_ ofKind : NSWindowCloseButton]; Now: [self adjustButton:closeButton_ ofKind:NSWindowCloseButton]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5e9f91c342f8efffe0423d516997ddbc408c9f53 |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: * and & are binary operators before ( and [. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2355cebe3847acd4ce175e3a88788b8effd93c6e |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: * and & are binary operators after ) and ]. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cc191d1980101bba47d3d67acf782890076fa5c3 |
|
12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: + and - after { are unary operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
67015ed2f40d6f69ee9e15d79aa88530f4b4afe2 |
|
11-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Format ObjC static and instance methods consistently, add a test for that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d5688cf3e314819ca196053ac245c19a7c321332 |
|
11-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fix single-line optimization for ObjC. Puts blocks always into multiple lines when they start with an ObjC keyword or minus. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
517e894c56211f57c487bdaba8ead0edc84396fe |
|
11-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Implements pulling simple blocks into a single line. void f() { return 42; } The final change that implements the feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
088dab50b76d235cd5b0e701048efccfcea3677e |
|
11-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Correct spacing around new and delete. This fixes llvm.org/PR14913. Before: A *a = new(placement) A; After: A *a = new (placement) A; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7d19bc2c8882457e833dfe9741ac5a4a7198e46f |
|
11-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of trailing declaration annotations. Before: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY( aaaaaaaaaaaaa); After: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(aaaaaaaaaaaaa); Also did some formatting cleanups with clang-format on the way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7e9bf8c249a5a9717447a00a8669596002a5569a |
|
11-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improved formatting of constructor initializers Added option to put each constructor initializer on its own line if not all initializers fit on a single line. Enabling this for Google style now as the style guide (arguable) suggests it. Not sure whether we also want it for LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
604eb4c741e58a114e2ae073991bb7944203b755 |
|
11-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Refactor IndentState into two classes. As we keep adding more stuff to it, this structure is easier to maintain. At one point we might think about making it an actual class with specific accessors, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cd52bdaaf076b0082c07c6b3d88937fb737054f1 |
|
11-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Put spaces in ObjC method decls in the right place for Google style. Objective-C method declarations look like this: - (returntype)name:(type)argname anothername:(type)arg2name; In google style, there's no space after the leading '-' but one after "(returntype)" instead (but none after the argument types), see http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions Not inserting the space after '-' is easy, but to insert the space after the return type, the formatter needs to know that a closing parenthesis ends the return type. To do this, I tweaked the code in parse() to check for this, which in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to parse(), because parse() runs before annotate(). (To keep things interesting, the return type is optional, but it's almost always there in practice.) http://llvm-reviews.chandlerc.com/D280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7084823f8ec4367019940b26245e01684b62c7e1 |
|
10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: No spaces around '=' in @property lines. Before: @property(assign, getter = isEditable) BOOL editable; Now: @property(assign, getter=isEditable) BOOL editable; It'd be nice if some Apple person could let me know if spaces are preferred around '=' in @synthesize lines (see FIXME in the test). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5f500df1b28e6b1c49d4256dda130ecd8696ea2e |
|
10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatting: In @implementation etc lines, put a space before protocol lists. Don't do this in Google style though: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols Most other places (function declarations, variable declarations) still get this wrong, and since this looks very similiar to template instantiations to the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f9ea2ed30a8dec954f3d78ca43afc0be914bb1db |
|
10-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Refactoring the outermost structure of the formatter. This is the last step of pure shuffling stuff around, the next step will be the actual feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
81ed2f1cd7202e84bf1f3868a60a36904499c94c |
|
10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Don't put a space in ObjC number literals like @+50 Before: @ -4.5 Now: @-4.5 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ed91bbaa8c4c92a1c94c9a7a5f4141551718cf6b |
|
10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Add space before '(' in @implemenation, @interface, @protocol lines The first token in @implementation, @interface, and @protocol lines is now marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked LT_ObjCMethodDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
94fc6f15d99a16abe6c28a7baa3f2358450920d1 |
|
10-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Pull calculation whether a line fits one level up. This is the next step towards being able to configure multiple unwrapped lines into one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3f8c7f3a07df65580a9ca0fe3e956b8a40956a79 |
|
10-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Pulling formatFirstToken one level up. This prepares the code for single line optimizations and changes the dependencies between single-line-formats to the indent of the first token. Conceptually, the first token is "between" the lines anyway, as the whitespace for the first token includes the previous end-of-line, which needs to be escaped when inside a preprocessor directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
c8c8a478639f1474f4c53d12befc405934083633 |
|
10-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fixes layout of right braces. We now decide whether a newline should go before the closing brace depending on whether a newline was inserted after the opening brace. For example, we now insert a newline before '};' in: static SomeClass WithALoooooooooooooooooooongName = { 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" }; ... while not inserting a newline here: static SomeClass = { a, b, c, d, e, f, g, h, i, j, looooooooooooooooooooooooooooooooooongname, looooooooooooooooooooooooooooooong }; Also fixes the formating of (column limit 25): int x = { avariable, b(alongervariable) }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
2851c16443dcdb9d8bb509d321fb827a560b47bc |
|
10-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fixes formatting of function calls etc inside an initializer list. We're now formatting (column limit 25): int x = { avariable, b(alongervariable) }; This also fixes: Aaa({ int i; }, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccc)); ... where we would previously break after the '},'. Putting the closing curly into an extra line when there's a break directly after the first curly will be done in a subsequent patch. Paired with djasper. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
46ef852618b18bc79e403b37a12c9b692e76126b |
|
10-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improvements to function type and ObjC block formatting. Before: int (^myBlock) (int) = ^(int num) {} A<void ()>; int (*b)(int); After: int (^myBlock)(int) = ^(int num) {} A<void()>; int(*b)(int); For function types and function pointer types, this patch only makes the behavior consistent (for types that are keywords and other types). For the latter function pointer type declarations, we'll probably want to add a space after "int". Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately Moved the LangOpts-settings to a public place for use by tests and clang-format binary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
5cf7cf317f684dc61b8a0e4476440b5635b80db4 |
|
10-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's understanding of casts. This fixes llvm.org/PR14684. Before: int *pa = (int *) & a; After: int *pa = (int *)&a; We still don't understand all kinds of casts. I added a FIXME to address that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
700e710544a50ec63f984b9b098530bf9107920a |
|
10-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Do more error checking for '{}'. This fixes llvm.org/PR14883, where clang-format would run into an assertion on: void f() { return } 42 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
880e538536d1a7597eb5805d67a08e3941577c7f |
|
10-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove unused @-formatting code. @optional @property is put on two different unwrapped lines now, so this is no longer necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
3fc0bb779e751de71166c20a365cd5c28c3de8ed |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Only align after assignments on the top level. This fixes llvm.org/PR14870 and we no longer mess up: template <typename T1, typename T2 = char, typename T3 = char, typename T4 = char> void f(); It removes the nice aligment for assignments inside other expressions, but I am not sure those are actually practically relevant. If so, we can fix those later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ceb99ab9d721848c0851c59f3fdd9c1ca85c58be |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't simply give up when exceeding 80cols, choose an "ok" option. This addresses llvm.org/PR14847. We can now format something like: int aaaaaaaaaaaaaaaaaaaaaaaaaaa = // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; clang-format unavoidably exceeds the column limit, but does not just flush everything into a single line. Moreover, it tries to minimize the number of characters beyond the column limit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d64f73812f3e6473ef8b6b6ec909bb9d8a510843 |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Correctly format wrapped function call parameters in templated functions. This fixes llvm.org/PR14846. Before: template <typename T> void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa); After: template <typename T> void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
043835aa876b1edeca0a05def0cc0989faa15892 |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow comments in the middle of statements to be on their own line. This fixes llvm.org/PR14860. Before, we messed up the format of: if (DeclaratorInfo.isFunctionDeclarator() && //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level && Tok.is(tok::semi) && NextToken().is(tok::l_brace)) { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
886568dc24eb0a1ccf73bf32d1eafa8fd4008cc6 |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix ObjC block declarations. Before: int ( ^ Block1) (int, int) = ^ (int i, int j) After: int (^Block1) (int, int) = ^(int i, int j) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9c837d05c9e6d6971900d36b1e462ed3666b7487 |
|
09-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of conditional operators. This addresses llvm.org/PR14864. We used to completely mess this up and now format as: Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
2db356d619fbf56e342fbc3fd5301e2e539e51b6 |
|
08-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't break after unary operators. Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, * aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cb4d690820295d93c1cea6c13fb4409b8c1db2cf |
|
08-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Format @ literals better. Array and dictionary literals need more work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
765561ff8fa636cc88d133b85ecb592094104554 |
|
08-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't put spaces around ##. In Clang/LLVM this seems to be the more common formatting for ##s. There might still be case that we miss, but we'll fix those as we go along. Before: #define A(X) void function ## X(); After: #define A(X) void function##X(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
a9ccdd1b8ef31d1942193ffa6bc32781055cf493 |
|
07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Add tests for try/catch. Let 'throw' start an expression. Before: throw a *b; Now: throw a * b; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d0af4b46741560cf2e52d819e1f3a2506a1e7a3c |
|
07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Don't put spaces betwen @ and objc keywords. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
da92771074afd709cbea552ae38717ac73d8011b |
|
07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Small refactoring of the formatter code. This should make it slightly more readable as it more clearly separates what happens where. No intended functional changes. More of this to come.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
decf7bcafd71af8c31cbc17eec1d6d050e2a1ea2 |
|
07-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Fix typo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
9cda8000434be3360abb38fe1690fa24ae3d48be |
|
07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Prefer not to break after assignments. This addresses llvm.org/PR14830. Before: unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(), SI->getPointerAddressSpace()); CharSourceRange LineRange = CharSourceRange::getTokenRange(TheLine.Tokens.front().Tok.getLocation(), TheLine.Tokens.back().Tok.getLocation()); After: unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(), SI->getPointerAddressSpace()); CharSourceRange LineRange = CharSourceRange::getTokenRange( TheLine.Tokens.front().Tok.getLocation(), TheLine.Tokens.back().Tok.getLocation()); This required rudimentary changes to static initializer lists, but we are not yet formatting them in a reasonable way. That will be done in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
7ad4effaa96905ef9dbc3815760b06b1d1639390 |
|
07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add style option for number of spaces before trailing comments. In LLVM style, a single space should be enough. In Google style, two spaces are required. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
71607512cb70db3c1be8f0287153b681531687fc |
|
07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Do not break before "0" in pure virtual function declarations. Before: virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) = 0 After: virtual void write(ELFWriter *writerrr, OwningPtr<FileOutputBuffer> &buffer) = 0; This addresses llvm.org/PR14815. To implement this I introduced a line type during parsing and moved the definition of TokenType out of the struct for increased readability. Should have done the latter in a separate patch, but it would be hard to pull apart now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f39f6ff8ea2c9136f890a47f0ab784359e9706e6 |
|
07-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Remove outdated fixme. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
d544c574ccbcbfcb5b3c3edd19956143826008cf |
|
07-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Do not ever allow using the full line in preprocessor directives. We would format: #define A \ int f(a); int i; as #define A \ int f(a);\ int i The fix will break up macro definitions that could fit a line, but hit the last column; fixing that is more involved, though, as it requires looking at the following line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
6cf581436e9e59a18f6a362027a69eaaa9b67597 |
|
07-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fix layouting of single-line-comments preceded by an escaped newline. Previously, we'd format int i;\ // comment as int i; // comment The problem is that the escaped newline is part of the next token, and thus the raw token text of the comment doesn't start with "//". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.cpp
|
46a46a20a3ec397192550915964cb227e87b79b2 |
|
07-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Put a higher penalty on breaking before "." or "->". This fixes llvm.org/PR14823. Before: local_state->SetString(prefs::kApplicationLocale, parent_local_state ->GetString(prefs::kApplicationLocale)); After: local_state->SetString( prefs::kApplicationLocale, parent_local_state->GetString(prefs::kApplicationLocale)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
9bb0d280faaedd528d2af7eeaf06c9f262345ad2 |
|
04-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Correctly format dereference and address of in array parameters. Before: InvalidRegions[ &R] = 0; After: InvalidRegions[&R] = 0; This fixes llvm.org/PR14793 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1f42f11870325d1869eb7d51b98ebf5e6d7bcc26 |
|
04-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let the formatter ignore UnwrappedLines containing errors. This prevents code like: namespace { class Foo { Foo( }; } // comment from causing segfaults (see llvm.org/PR14774). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
060143e4ad7f80c4349d472c06a63a953650c2a9 |
|
02-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fixes multiple formatting bugs. Fixes: - incorrect handling of multiple consecutive preprocessor directives - crash when trying to right align the escpaed newline for a line that is longer than the column limit - using only ColumnLimit-1 columns when layouting with escaped newlines inside preprocessor directives git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5eda31ee30106c769b5829683761d42e6e50467f |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't allow line breaks after template parameters. This fixes llvm.org/PR14786. We will need to split there as a last resort, but that should be done consistently independent of whether the type is a template type or not. Before: template <typename T> aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T> ::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: template <typename T> aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
ba3d3074e8ef4c4c05ac062b073b2e082e6a0206 |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Format */& as binary operator if followed by a unary operator. This fixes llvm.org/PR14687. Also fixes segfault for lines starting with * or &. Before: a *~b; *a = 1; // <- this segfaulted After: a * ~b; *a = 1; // no segfault :-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
ef5b9c3d38a1f6d0921591cb2749e529a8cc4a2e |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Correctly format pointers and references in casts. This fixes llvm.org/PR14747. Before: Type *A = (Type * ) P; After: Type *A = (Type *) P; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1f0754bf761f7d4910348ce3aba867d34473bceb |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Understand unary operators after "return" and "case". This fixes llvm.org/PR14746. Before: return - 1; After: return -1; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9a64fb5690ba2b53c761def068e20ec64c584d96 |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Prefer splitting after "template <...>" and fix indentation. This addresses llvm.org/PR14699 Before: template <typename T> void looooooooooooooooooooooongFunction(int Param1, int Param2); template <typename T> void looooooooooooooooooooongFunction( int Paaaaaaaaaaaaaaaaaaaaram1, int Paaaaaaaaaaaaaaaaaaaaram2); After: template <typename T> void looooooooooooooooooooooongFunction(int Param1, int Param2); template <typename T> void looooooooooooooooooooongFunction(int Paaaaaaaaaaaaaaaaaaaaram1, int Paaaaaaaaaaaaaaaaaaaaram2); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
723f0304eaaf1aed20aece9021a1bb8578477e75 |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Prefer to break after operators over breaking after "(". Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b99083e60325a28063fb588f458a871151971fdc |
|
02-Jan-2013 |
Chandler Carruth <chandlerc@gmail.com> |
Re-sort #include lines using the llvm/utils/sort_includes.py script. Removes a duplicate #include as well as cleaning up some sort order regressions since I last ran the script over Clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5d334407e68e45e3e7baa0cd140d4fd75e7483d6 |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Understand * and & in ternary expressions. Before: "int a = b ? *c : * d;" After: "int a = b ? *c : *d; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
4dc41def6129bcecd4d08e5ffafe021aa7b1fa2a |
|
02-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't break after pointer or reference specifier. This fixes llvm.org/PR14717. Buggy format: TypeSpecDecl * TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) { Now changed to: TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) { git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
a4974cf6ae618f04d5dd7fc45bc18bff41ca86bf |
|
24-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Penalize tokens with a lower parenthesis level than the start of the line. This prevents formattings like this (assuming "parameter" doesn't fit the line): bool f = someFunction() && someFunctionWithParam( parameter) && someOtherFunction(); Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but there are subsequent tokens ("&&" and "someOtherFunction") with a lower level. This is bad for readability as "parameter" hides "someOtherFunction". With this patch, this changes to: bool f = someFunction() && someFunctionWithParam(parameter) && someOtherFunction(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cf225b67e66d7a85773b7bf7907c0fef4374c31b |
|
24-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Align RHS after assignments and return statements. This changes: int Result = a + // force break b; return Result + // force break 5; To: int Result = a + // force break b; return Result + // force break 5; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
f6aef6a25bd47f2a7bfc24938e29b746fdccdc72 |
|
24-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Fix formatting over overloaded operators. This fixes llvm.org/pr14686. We used to add too many spaces for different versions of overloaded operator function declarations/definitions. This patch changes, e.g. operator *() {} operator >() {} operator () () {} to operator*() {} operator>() {} operator()() {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
e2c7acf58856fec94ed2b8089116e1ad80e3c30f |
|
24-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Take operator precedence into account when splitting lines. With this patch, splitting after binary operators has a panelty corresponding to the operator's precedence. We used to ignore this and eagerly format like: if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. } With this patch, this becomes: if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
00d5a04dc0eaa0f067656033ab81fc352c5a991a |
|
23-Dec-2012 |
Nico Weber <nicolasweber@gmx.de> |
libFormat: Teach the *& usage heuristic that "return" starts a rhs too. "return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;". Fixes PR14687 partially. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
b23ae0c5104a4fec4c2ff603143fe142ec409249 |
|
21-Dec-2012 |
Nico Weber <nicolasweber@gmx.de> |
format: Handle #import as include directive too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
cd1a32b1f02016fe5ebb1142aadccc54bbdf5d89 |
|
21-Dec-2012 |
Daniel Jasper <djasper@google.com> |
clang-format: No spaces around directory specifiers This fixes PR14683. We used to format like this: #include <a / b> And this patch changes this to: #include <a/b> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
5f04ef52837c82e99baac4e6041526f829c4e04b |
|
21-Dec-2012 |
Fariborz Jahanian <fjahanian@apple.com> |
Fix typo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a324a0e673cf486de281c84af3f09ba58627bbd2 |
|
21-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Basic support for formatting for-loops. We used to not really format them. Now we do: for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(), SE = BB->succ_end(); SI != SE; ++SI) { This is just one example and I am sure we still mess some of them up, but it is a step forward. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
675d2e34889a1b7e9d4cc659a4cdc33ce0f5b152 |
|
21-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Use OperatorPrecedence.h in clang-format No indented functional changes other than handling more operators correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
98e6b4a65fcc81b1be11f09837e0fc8fac85897b |
|
21-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Formatting fixes for PR14680 Also, some (automated) formatting fixes and slight cleanups. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
154120cde4f56ed04261bab302fdbbed1a7f080b |
|
20-Dec-2012 |
Fariborz Jahanian <fjahanian@apple.com> |
Add objective-C style formatting to clang format and use it to format xml declaration tags. // rdar://12378714 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
1321eb593c8e13738dcaf72e409aa466c8cf6463 |
|
18-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Better support for constructor initializers. We used to format initializers like this (with a sort of hacky implementation): Constructor() : Val1(A), Val2(B) { and now format like this (with a somewhat better solution): Constructor() : Val1(A), Val2(B) { assuming this would not fit on a single line. Also added tests. As a side effect we now first analyze whether an UnwrappedLine needs to be split at all. If not, not splitting it is the best solution by definition. As this should be a very common case in normal code, not exploring the entire solution space can provide significant speedup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
9a0b494f999dfd47152565f7bbeaa69b3fef8feb |
|
17-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Add basic support for splitting before function calls if it can't be avoided. This required a minor modification of the memoization as now the "CurrentPenalty" depends on whether or not we break before the current token. Therefore, the CurrentPenalty should not be memoized but added after retrieving a value from memory. This should not affect the runtime behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
8b39c6693aadd30f77ac039de69130c22e066994 |
|
10-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Addi formatting tests for pointer template parameters. Fix spacing before ",". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
c74e2794bebaab41213f23b27c09c21cb1e1f81b |
|
07-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Small tweaks to clang-format. Now not joining keywords with '::' and not putting a space between a pointer pointer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
d56a737842f28db4403430082c4d2686bc6cc3b3 |
|
06-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's handling of unary operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
3b5943f535eca0e0b91f4bcda9d09c9c275cf855 |
|
06-Dec-2012 |
Daniel Jasper <djasper@google.com> |
"<<" alignment for clang-format. Also, small fix for handling the first token correctly. Review: http://llvm-reviews.chandlerc.com/D177 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
dfbb3197de8407a4209f328e4de1ae73bac70b8b |
|
05-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Remove bad and useless enum to bool conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.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/Format.cpp
|
112fb27ab48ae3256173806a073ba7b88aa6531a |
|
05-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Small tweaks to automatic formatting. Recognize '!=' as a binary operator and assume that there are no type definitions on the RHS of an assignment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
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/Format.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/Format.cpp
|
20409155c75e78bceb622a5e0d1fad40df70f34d |
|
04-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Make parenthesis counting and aligning a bit saner. Review: http://llvm-reviews.chandlerc.com/D162 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
8822d3a99c07c7d874f8bfd81a7fe02059b9c19e |
|
04-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Small fixes to unary operator recognition and handling of include directives. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.cpp
|
a88bb45f11c1e27f9caf60a85a8e1774d3e09ead |
|
04-Dec-2012 |
Daniel Jasper <djasper@google.com> |
Replace workarounds with correct fixes. Also fix header guard. http://llvm-reviews.chandlerc.com/D159 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|
0be4b36830a26026726d05aae5434c6658abc65f |
|
03-Dec-2012 |
Manuel Klimek <klimek@google.com> |
Fixes a compile warning and crash in the tests. The necessity of this fix points to a problem with the design of the addToken during the optimiation phase, which we need to address in a much more principled way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/Format.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/Format.cpp
|