r294457 - [clang-format] Move OriginalPrefix from base to subclass.

Krasimir Georgiev via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 8 06:45:19 PST 2017


Author: krasimir
Date: Wed Feb  8 08:45:19 2017
New Revision: 294457

URL: http://llvm.org/viewvc/llvm-project?rev=294457&view=rev
Log:
[clang-format] Move OriginalPrefix from base to subclass.

Summary:
OriginalPrefix is only needed for line comment sections. Moved from the base class to the child class.
No functional changes.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29716

Modified:
    cfe/trunk/lib/Format/BreakableToken.h

Modified: cfe/trunk/lib/Format/BreakableToken.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.h?rev=294457&r1=294456&r2=294457&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.h (original)
+++ cfe/trunk/lib/Format/BreakableToken.h Wed Feb  8 08:45:19 2017
@@ -282,10 +282,6 @@ protected:
   // line.
   bool FirstInLine;
 
-  // In case of line comments, holds the original prefix, including trailing
-  // whitespace.
-  SmallVector<StringRef, 16> OriginalPrefix;
-
   // The prefix to use in front a line that has been reflown up.
   // For example, when reflowing the second line after the first here:
   // // comment 1
@@ -394,6 +390,14 @@ private:
   unsigned getContentStartColumn(unsigned LineIndex,
                                  unsigned TailOffset) const override;
 
+  // OriginalPrefix[i] contains the original prefix of line i, including
+  // trailing whitespace before the start of the content. The indentation
+  // preceding the prefix is not included.
+  // For example, if the line is:
+  // // content
+  // then the original prefix is "// ".
+  SmallVector<StringRef, 16> OriginalPrefix;
+
   // Prefix[i] contains the intended leading "//" with trailing spaces to
   // account for the indentation of content within the comment at line i after
   // formatting. It can be different than the original prefix when the original




More information about the cfe-commits mailing list