summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/WhitespaceManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.h')
-rw-r--r--clang/lib/Format/WhitespaceManager.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h
index 25b7690a154..11167fa4c3c 100644
--- a/clang/lib/Format/WhitespaceManager.h
+++ b/clang/lib/Format/WhitespaceManager.h
@@ -52,17 +52,19 @@ public:
/// was not called.
void addUntouchableToken(const FormatToken &Tok, bool InPPDirective);
- /// \brief Inserts a line break into the middle of a token.
+ /// \brief Inserts or replaces whitespace in the middle of a token.
///
- /// Will break at \p Offset inside \p Tok, putting \p PreviousPostfix before
- /// the line break and \p CurrentPrefix before the rest of the token starts in
- /// the next line.
+ /// Inserts \p PreviousPostfix, \p Newlines, \p Spaces and \p CurrentPrefix
+ /// (in this order) at \p Offset inside \p Tok, replacing \p ReplaceChars
+ /// characters.
///
- /// \p InPPDirective and \p Spaces are used to generate the correct line
- /// break.
- void breakToken(const FormatToken &Tok, unsigned Offset,
- unsigned ReplaceChars, StringRef PreviousPostfix,
- StringRef CurrentPrefix, bool InPPDirective, unsigned Spaces);
+ /// When \p InPPDirective is true, escaped newlines are inserted. \p Spaces is
+ /// used to align backslashes correctly.
+ void replaceWhitespaceInToken(const FormatToken &Tok, unsigned Offset,
+ unsigned ReplaceChars,
+ StringRef PreviousPostfix,
+ StringRef CurrentPrefix, bool InPPDirective,
+ unsigned Newlines, unsigned Spaces);
/// \brief Returns all the \c Replacements created during formatting.
const tooling::Replacements &generateReplacements();
@@ -151,8 +153,8 @@ private:
/// \brief Stores \p Text as the replacement for the whitespace in \p Range.
void storeReplacement(const SourceRange &Range, StringRef Text);
- std::string getNewLineText(unsigned NewLines, unsigned Spaces);
- std::string getNewLineText(unsigned NewLines, unsigned Spaces,
+ std::string getNewlineText(unsigned Newlines, unsigned Spaces);
+ std::string getNewlineText(unsigned Newlines, unsigned Spaces,
unsigned PreviousEndOfTokenColumn,
unsigned EscapedNewlineColumn);
std::string getIndentText(unsigned Spaces);
OpenPOWER on IntegriCloud