diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-06-11 16:01:49 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-06-11 16:01:49 +0000 |
commit | 555efc36d08b07e65e2aba65c91fcaec63834c29 (patch) | |
tree | 4084d1b79103bd7851ece8261c34c59ec040d62e /clang/lib/Format/BreakableToken.h | |
parent | 447d2d12f0d4a41feeb88341bddbaa79c36a5103 (diff) | |
download | bcm5719-llvm-555efc36d08b07e65e2aba65c91fcaec63834c29.tar.gz bcm5719-llvm-555efc36d08b07e65e2aba65c91fcaec63834c29.zip |
Insert a space at the start of a line comment in case it starts with an alphanumeric character.
Summary:
"//Test" becomes "// Test". This change is aimed to improve code
readability and conformance to certain coding styles. If a comment starts with a
non-alphanumeric character, the space isn't added, e.g. "//-*-c++-*-" stays
unchanged.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D949
llvm-svn: 183750
Diffstat (limited to 'clang/lib/Format/BreakableToken.h')
-rw-r--r-- | clang/lib/Format/BreakableToken.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index 100bb19dc5d..4c8755b95b5 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -84,8 +84,6 @@ public: virtual unsigned getLineLengthAfterSplit(unsigned LineIndex, unsigned TailOffset, StringRef::size_type Length) const; - virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, - bool InPPDirective, WhitespaceManager &Whitespaces); protected: BreakableSingleLineToken(const FormatToken &Tok, unsigned StartColumn, @@ -113,6 +111,9 @@ public: virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const; + virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, + bool InPPDirective, + WhitespaceManager &Whitespaces); }; class BreakableLineComment : public BreakableSingleLineToken { @@ -126,6 +127,15 @@ public: virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const; + virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, + bool InPPDirective, WhitespaceManager &Whitespaces); + virtual void replaceWhitespaceBefore(unsigned LineIndex, + unsigned InPPDirective, + WhitespaceManager &Whitespaces); + +private: + // The prefix without an additional space if one was added. + StringRef OriginalPrefix; }; class BreakableBlockComment : public BreakableToken { |