summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/FormatToken.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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. llvm-svn: 193345
* 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. llvm-svn: 193325
* 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(); } llvm-svn: 192503
* 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 }; llvm-svn: 190674
* 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 llvm-svn: 190395
* 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}}; llvm-svn: 189327
* 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 */ }; llvm-svn: 189211
* 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. llvm-svn: 189094
* 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 llvm-svn: 189018
OpenPOWER on IntegriCloud