summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Better support for constructor initializers.Daniel Jasper2012-12-181-49/+44
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 170457
* Add basic support for splitting before function calls if it can't beDaniel Jasper2012-12-171-16/+29
| | | | | | | | | | | | 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. llvm-svn: 170337
* Fix several formatting problems.Daniel Jasper2012-12-171-4/+5
| | | | | | | | | More specifically: - Improve formatting of static initializers. - Fix formatting of lines comments in enums. - Fix formmating of trailing line comments. llvm-svn: 170316
* Addi formatting tests for pointer template parameters.Daniel Jasper2012-12-101-2/+2
| | | | | | Fix spacing before ",". llvm-svn: 169746
* Clang-format: error recovery for access specifiersAlexander Kornienko2012-12-101-2/+3
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D198 llvm-svn: 169738
* Clang-format: extracted FormatTokenSource from UnwrappedLineParser.Alexander Kornienko2012-12-071-1/+63
| | | | | | | | | | | | | | 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 llvm-svn: 169605
* Small tweaks to clang-format.Daniel Jasper2012-12-071-3/+7
| | | | | | | Now not joining keywords with '::' and not putting a space between a pointer pointer. llvm-svn: 169594
* Clang-format: IndentCaseLabels option, proper namespace handlingAlexander Kornienko2012-12-061-1/+3
| | | | | | | | | | | | | | 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 llvm-svn: 169520
* Improve clang-format's handling of unary operators.Daniel Jasper2012-12-061-0/+12
| | | | llvm-svn: 169500
* "<<" alignment for clang-format.Daniel Jasper2012-12-061-7/+41
| | | | | | | Also, small fix for handling the first token correctly. Review: http://llvm-reviews.chandlerc.com/D177 llvm-svn: 169488
* Remove bad and useless enum to bool conversion.Daniel Jasper2012-12-051-5/+2
| | | | llvm-svn: 169390
* Indentation fixes for clang-format.Daniel Jasper2012-12-051-30/+45
| | | | | | | | | | - 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 llvm-svn: 169384
* Follow-up to r169286, addresses comments in ↵Alexander Kornienko2012-12-051-4/+5
| | | | | | http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename llvm-svn: 169382
* Small tweaks to automatic formatting.Daniel Jasper2012-12-051-2/+13
| | | | | | | Recognize '!=' as a binary operator and assume that there are no type definitions on the RHS of an assignment. llvm-svn: 169363
* Add missing destructors found with -Wnon-virtual-dtor.Daniel Jasper2012-12-041-0/+3
| | | | llvm-svn: 169303
* Error recovery part 2Alexander Kornienko2012-12-041-22/+38
| | | | | | | | | | | | | | 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 llvm-svn: 169286
* Make parenthesis counting and aligning a bit saner.Daniel Jasper2012-12-041-40/+53
| | | | | Review: http://llvm-reviews.chandlerc.com/D162 llvm-svn: 169274
* Small fixes to unary operator recognition and handling of includeDaniel Jasper2012-12-041-6/+20
| | | | | | directives. llvm-svn: 169261
* Replace workarounds with correct fixes.Daniel Jasper2012-12-041-16/+16
| | | | | | | | Also fix header guard. http://llvm-reviews.chandlerc.com/D159 llvm-svn: 169254
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+1
| | | | | | | | | | | | | 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. llvm-svn: 169237
* Fixes a compile warning and crash in the tests.Manuel Klimek2012-12-031-12/+13
| | | | | | | | 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. llvm-svn: 169151
* Initial version of formatting library.Daniel Jasper2012-12-031-0/+704
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 llvm-svn: 169137
OpenPOWER on IntegriCloud