summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/BreakableToken.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix another clang-format crasher related to multi-line comments.Daniel Jasper2013-05-301-0/+3
| | | | | | | | | | This fixes: /* * * something long going over the column limit. */ llvm-svn: 182932
* Add asserts to guard against regressions.Manuel Klimek2013-05-301-0/+2
| | | | llvm-svn: 182916
* Fix crasher when formatting certain block comments.Daniel Jasper2013-05-301-0/+5
| | | | | | | | | Smallest reproduction: /* ** */ llvm-svn: 182913
* Fixes error when splitting block comments.Manuel Klimek2013-05-291-2/+10
| | | | | | | | When trying to fall back to search from the end onwards, we would still find leading whitespace if the leading whitespace went on after the end of the line. llvm-svn: 182886
* Disable tab expansion when counting the columns in block comments.Manuel Klimek2013-05-281-10/+8
| | | | | | | | | | | | | | | | | To fully support this, we also need to expand tabs in the text before the block comment. This patch breaks indentation when there was a non-standard mixture of spaces and tabs used for indentation, but fixes a regression in the simple case: { /* * Comment. */ int i; } Is now formatted correctly, if there were tabs used for indentation before. llvm-svn: 182760
* Fixes indentation of empty lines in block comments.Manuel Klimek2013-05-281-2/+11
| | | | | | | | | | | Block comment indentation of empty lines regressed, as we did not have a test for it. /* Comment with... * * empty line. */ is now formatted correctly again. llvm-svn: 182757
* Major refactoring of BreakableToken.Manuel Klimek2013-05-271-120/+280
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 182738
* Makes whitespace management more consistent.Manuel Klimek2013-05-221-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 182467
* Unified token breaking logic: support for line comments.Alexander Kornienko2013-04-171-56/+74
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 179693
* Unified token breaking logic for strings and block comments.Alexander Kornienko2013-04-151-0/+161
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 llvm-svn: 179526
OpenPOWER on IntegriCloud