summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixes handling of unbalances braces.Manuel Klimek2013-01-061-1/+1
| | | | | | | | | | | | | If we find an unexpected closing brace, we must not stop parsing, as we'd otherwise not layout anything beyond that point. If we find a structural error on the highest level we'll not re-indent anyway, but we'll still want to format within unwrapped lines. Needed to introduce a differentiation between an expected and unexpected closing brace. llvm-svn: 171666
* Fixes parsing of hash tokens in the middle of a line.Manuel Klimek2013-01-051-1/+5
| | | | | | | | | | | 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. llvm-svn: 171640
* Fixes PR14801 - preprocessor directives shouldn't be indentedManuel Klimek2013-01-051-0/+3
| | | | | | | Uses indent 0 for macros for now and resets the indent state to the level prior to the preprocessor directive. llvm-svn: 171639
* Various fixes to clang-format's macro handling.Manuel Klimek2013-01-041-1/+5
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 171556
* Fixes use of unescaped newlines when formatting preprocessor directives.Manuel Klimek2013-01-021-2/+10
| | | | | | | | | | | 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. llvm-svn: 171393
* Let clang-format format itself.Daniel Jasper2012-12-241-1/+1
| | | | | | | | 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. llvm-svn: 171039
* Fix several formatting problems.Daniel Jasper2012-12-171-1/+1
| | | | | | | | | More specifically: - Improve formatting of static initializers. - Fix formatting of lines comments in enums. - Fix formmating of trailing line comments. llvm-svn: 170316
* Appease -Wnon-virtual-dtorMatt Beaumont-Gay2012-12-071-0/+2
| | | | llvm-svn: 169648
* Clang-format: extracted FormatTokenSource from UnwrappedLineParser.Alexander Kornienko2012-12-071-10/+7
| | | | | | | | | | | | | | 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
* Clang-format: IndentCaseLabels option, proper namespace handlingAlexander Kornienko2012-12-061-2/+6
| | | | | | | | | | | | | | 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
* Clang-format: parse for and while loopsAlexander Kornienko2012-12-051-0/+1
| | | | | | | | | | | | | | Summary: Adds support for formatting for and while loops. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D174 llvm-svn: 169387
* Follow-up to r169286, addresses comments in ↵Alexander Kornienko2012-12-051-1/+1
| | | | | | http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename llvm-svn: 169382
* Add missing destructors found with -Wnon-virtual-dtor.Daniel Jasper2012-12-041-0/+2
| | | | llvm-svn: 169303
* Error recovery part 2Alexander Kornienko2012-12-041-3/+4
| | | | | | | | | | | | | | 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
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | 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
* Initial version of formatting library.Daniel Jasper2012-12-031-0/+119
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