summaryrefslogtreecommitdiffstats
path: root/lib/Format/FormatToken.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-format clang-format.Manuel Klimek2017-09-201-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313744 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-0/+1
| | | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312794 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-1/+0
| | | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312784 91177308-0d34-0410-b5e6-96231b3b80d8
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-0/+1
| | | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312781 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix bug in handling of single-column lists.Daniel Jasper2016-12-211-8/+6
| | | | | | | | | | | | | | | | | | | Members that are themselves wrapped in fake parentheses would lead to AvoidBinPacking be set on the wrong ParenState. After: vector<int> aaaa = { aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, }; Before we were falling back to bin-packing these. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290259 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix regression introduced in r290084.Daniel Jasper2016-12-191-0/+8
| | | | | | | | | | | | | | | | | | | We still want to try in linewrap within single elements of a 1-column list. After: Type *Params[] = {PointerType::getUnqual(FunctionType::get( Builder.getVoidTy(), Builder.getInt8PtrTy(), false)), Builder.getInt8PtrTy(), Builder.getInt32Ty(), LongType, LongType, LongType}; Before: No line break in the first element, so column limit violation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290090 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Allow "single column" list layout even if that violates theDaniel Jasper2016-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column limit. Single-column layout basically means that we format the list with one element per line. Not doing that when there is a column limit violation doesn't change the fact that there is an item that doesn't fit within the column limit. Before (with a column limit of 30): std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa}; After: std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa}; (and previously we would have formatted like "After" it wasn't for the one item that is too long) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290084 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-181-2/+1
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-091-0/+1
| | | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268898 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-151-1/+0
| | | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266460 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-131-0/+1
| | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266186 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Align long braced init lists even if they are nested inDaniel Jasper2016-01-041-4/+6
| | | | | | function calls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256740 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: [JS] Conservatively introduce column layout for JS arrayDaniel Jasper2015-12-221-4/+12
| | | | | | | | initializers. For now, only use it for 20 items or more. Otherwise, clang-format formats these one-per-line and thus increases the vertical code size a lot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256246 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.Daniel Jasper2015-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: If this option is set, clang-format will always insert a line wrap, e.g. before the first parameter of a function call unless all parameters fit on the same line. This obviates the need to make a decision on the alignment itself. Use this style for Google's JavaScript style and add some minor tweaks to correctly handle nested blocks etc. with it. Don't use this option for for/while loops. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D14104 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251405 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-231-1/+1
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248367 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix column layout with a comment in the last line.Daniel Jasper2015-07-151-1/+2
| | | | | | | | | | | | | | | | | | Before: int aaaaa[] = { 1, 2, 3, // comment 4, 5, 6 // comment }; After: int aaaaa[] = { 1, 2, 3, // comment 4, 5, 6 // comment }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242299 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Print token type name instead of number in -debug outputBirunthan Mohanathas2015-07-131-0/+14
| | | | | | | Differential Revision: http://reviews.llvm.org/D11125 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242039 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Hoist vector allocation out of loop. NFC.Benjamin Kramer2015-06-121-2/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239604 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Guard the bin-packing in braced lists on BinPackArgumentsDaniel Jasper2015-05-261-3/+3
| | | | | | | | instead of BinPackParameters. Braced lists are used as constructor calls in many places and so the bin-packing should follow what is done for other calls and not what is done for function declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238184 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Don't use column layout in lists that have separatingDaniel Jasper2015-05-151-5/+7
| | | | | | | | comments. At some point, we might to want to a layout with a different number of columns instead, but at the moment, this causes more confusion than it's worth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237427 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Support column layout with comment after {.Daniel Jasper2015-05-131-4/+6
| | | | | | | | | | | | | | | | Before: vector<int> iiiiiiiiiiiiiii = { // 1111111111, 2222222222, 33333333333, 4444444444, // 111111111, 222222222, 3333333333, 444444444, // 11111111, 22222222, 333333333, 44444444}; After: vector<int> iiiiiiiiiiiiiii = { // 1111111111, 2222222222, 33333333333, 4444444444, // 111111111, 222222222, 3333333333, 444444444, // 11111111, 22222222, 333333333, 44444444}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237233 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Appease the buildbots by including climits.Daniel Jasper2015-05-111-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236995 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Improve column layout.Daniel Jasper2015-05-111-14/+18
| | | | | | | | | | | | | | | | | | | | | | Specifically, calculate the deviation between the shortest and longest element (which is used to prevent excessive whitespace) per column, not overall. This automatically handles the corner cases of a single column and a single row so that the actualy implementation becomes simpler. Before: vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa, 2, bbbbbbbbbbbbbbbbbbbbbb, 3, cccccccccccccccccccccc}; After: vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa, 2, bbbbbbbbbbbbbbbbbbbbbb, 3, cccccccccccccccccccccc}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236992 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Several improvements around formatting braced lists.Daniel Jasper2015-05-081-3/+4
| | | | | | | | | | | | | In particular: * If the difference between the longest and shortest element, we copped out of column format completely. Now, we instead allow to arrange these in a single column, essentially enforcing a one-per-line format. * Allow column layout even if there are braced lists. Especially, if there are many short lists, this can be beneficial. The bad case, where there is a long nested init list is usually caught as we now limit the length difference of the longest and shortest element. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236851 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix crash on invalid code.Daniel Jasper2015-01-191-1/+2
| | | | | | Input "a<," made clang-format crash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226450 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Don't use column layout with AlignAfterOpenBrackets.Daniel Jasper2014-11-271-0/+4
| | | | | | This fixes llvm.org/PR21676. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222886 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Prevent column layout if elements aren't uniform enough.Daniel Jasper2014-09-191-2/+10
| | | | | | | | | | | | | | | | | | | | | | | This patch only considers the difference between the length of the shortest and longest element, but we might want to look at other features (token count, etc.) in future. Before: std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{ aaaaaaa, aaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a, aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa, aaaaaaa, a}; After: std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{ aaaaaaa, aaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a, aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa, aaaaaaa, a}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218111 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Format long lists in columns if without bin-packing.Daniel Jasper2014-08-131-3/+5
| | | | | | | | | | | | | | | | After (even with BinPacking = false): const Aaaaaa aaaaa = { aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk, aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk, }; Before: <each element on its own line> This fixes http://llvm.org/PR20623. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215529 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix bug introduced by r208392.Daniel Jasper2014-05-091-8/+5
| | | | | | Also run clang-format over clang-format's files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208409 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-05-091-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208392 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Respect BinPackParameters in Cpp11BracedListStyle.Daniel Jasper2014-04-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | With BinPackParameters=false and Cpp11BracedListStyle=true (i.e. mostly for Chromium): Before: const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk}; After: const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk}; This fixes llvm.org/PR19359. I am not sure we'll want this in all cases in the long run, but I'll guess we'll get feedback on that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206458 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Enable formatting of lambdas with explicit return type.Daniel Jasper2014-01-161-0/+30
| | | | | | | | | So clang-format can now format: int c = []()->int { return 2; }(); int c = []()->vector<int> { return { 2 }; }(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199368 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Some tweaks to braces list formatting:Daniel Jasper2014-01-091-13/+20
| | | | | | | | | - Format a braced list with one element per line if it has nested braced lists. - Use a column layout only when the list has 6+ elements (instead of the current 4+ elements). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198869 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Be more conservative about braced list column layout.Daniel Jasper2013-12-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically disable it for nested braced lists as it commonly can look really weird. Eventually, we'll want to become smarter and format some of the nested lists better. Before: SomeStruct my_struct_array = { { aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaa, aaa }, { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa }, { aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa }, }; After: SomeStruct my_struct_array = { { aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaa, aaaaaaa, aaa }, { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa }, { aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa }, }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196783 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196510 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Prefer column layout if possible.Daniel Jasper2013-11-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Add a severe penalty for not using column layout for braced lists. If there are solutions with column layout, these are generally preferable over bin-packed solutions. Before: std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{ aaaaaaa, aaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a, aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa, aaaaaaa, a }; After: std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{ aaaaaaa, aaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a, aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa, aaaaaaa, a }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195546 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Be more conservative about column layout formatting.Daniel Jasper2013-10-241-1/+9
| | | | | | | | | | | Specifically, if a braced list has at least one nested braced list, format it either all on one line or in one column (i.e. one item per line). This seems in general to be an improvement as the structure of nested braced lists can make a tightly packed outer braced list hard to read. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193345 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Cleanup array initializer and dict initializer formatting.Daniel Jasper2013-10-241-0/+1
| | | | | | | | Significant changes: - Also recognize these literals with missing "@" for robustness. - Reorganize tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193325 91177308-0d34-0410-b5e6-96231b3b80d8
* Support formatting of preprocessor branches.Manuel Klimek2013-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | 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
* clang-format: Fix incorrect enum parsing / layouting.Daniel Jasper2013-09-131-0/+1
| | | | | | | | | | | | | | | 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
* Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.Alexander Kornienko2013-09-101-2/+2
| | | | | | | | | | | | | | | | 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
* clang-format: Fix bug in column layout.Daniel Jasper2013-08-271-2/+6
| | | | | | | | | | | | Before (with 60 character limit in Google style): return { {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}}; After: return {{aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189327 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Fix bug in column-layout formatting.Daniel Jasper2013-08-261-8/+8
| | | | | | | | | | Specific arrangements of comments after trailing commas could confuse the column width calculation, e.g. in: vector<int> x = { a, b, /* some */ /* comment */ }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189211 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Handle trailing commas in column layout of braced list.Daniel Jasper2013-08-231-0/+5
| | | | | | | | | | Before, this was causing errors. Also exit early in breakProtrudingToken() (before the expensive call to SourceManager::getSpellingColumnNumber()). This makes formatting huge (100k+-item) braced lists possible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189094 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add column layout formatting for braced listsDaniel Jasper2013-08-221-0/+184
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