diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-07-08 14:12:07 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-07-08 14:12:07 +0000 |
commit | 614d96a1f689ee126e974f8c8d15194a9d881075 (patch) | |
tree | 10f3d3fa71520ea51f421e5c1e022b96c2bbb6d2 /clang/lib/Format/BreakableToken.h | |
parent | ddd7b6a1c8dc21e700a20d05a12210e6c063a510 (diff) | |
download | bcm5719-llvm-614d96a1f689ee126e974f8c8d15194a9d881075.tar.gz bcm5719-llvm-614d96a1f689ee126e974f8c8d15194a9d881075.zip |
Fix for corner cases in code handling leading "* " decorations in block comments
Summary:
Fixes problems that lead to incorrect formatting of these and similar snippets:
/*
**
*/
/*
**/
/*
* */
/*
*test
*/
Clang-format used to think that all the cases above use "* " decoration, and
failed to calculate insertion position properly. It also used to remove leading
"* " in the last line.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1113
llvm-svn: 185818
Diffstat (limited to 'clang/lib/Format/BreakableToken.h')
-rw-r--r-- | clang/lib/Format/BreakableToken.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index 9dab473d8a8..afcc8b83a53 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -208,6 +208,10 @@ private: // instead. unsigned IndentAtLineBreak; + // This is to distinguish between the case when the last line was empty and + // the case when it started with a decoration ("*" or "* "). + bool LastLineNeedsDecoration; + // Either "* " if all lines begin with a "*", or empty. StringRef Decoration; }; |