15 #ifndef LLVM_CLANG_LIB_FORMAT_CONTINUATIONINDENTER_H 16 #define LLVM_CLANG_LIB_FORMAT_CONTINUATIONINDENTER_H 21 #include "llvm/Support/Regex.h" 35 struct RawStringFormatStyleManager;
36 class WhitespaceManager;
59 bool BinPackInconclusiveFunctions);
65 LineState getInitialState(
unsigned FirstIndent,
unsigned FirstStartColumn,
84 unsigned addTokenToState(
LineState &State,
bool Newline,
bool DryRun,
85 unsigned ExtraSpaces = 0);
89 unsigned getColumnLimit(
const LineState &State)
const;
94 unsigned moveStateToNextToken(
LineState &State,
bool DryRun,
bool Newline);
97 void moveStatePastFakeLParens(
LineState &State,
bool Newline);
99 void moveStatePastFakeRParens(
LineState &State);
102 void moveStatePastScopeOpener(
LineState &State,
bool Newline);
104 void moveStatePastScopeCloser(
LineState &State);
106 void moveStateToNewBlock(
LineState &State);
111 unsigned reformatRawStringLiteral(
const FormatToken &Current,
114 bool DryRun,
bool Newline);
119 bool DryRun,
bool AllowBreak,
bool Newline);
144 std::pair<unsigned, bool> breakProtrudingToken(
const FormatToken &Current,
146 bool AllowBreak,
bool DryRun,
151 std::unique_ptr<BreakableToken>
162 void addTokenOnCurrentLine(
LineState &State,
bool DryRun,
163 unsigned ExtraSpaces);
172 unsigned addTokenOnNewLine(
LineState &State,
bool DryRun);
175 unsigned getNewLineColumn(
const LineState &State);
189 bool nextIsMultilineString(
const LineState &State);
196 bool BinPackInconclusiveFunctions;
197 llvm::Regex CommentPragmasRegex;
203 bool AvoidBinPacking,
bool NoLineBreak)
204 : Tok(Tok), Indent(Indent), LastSpace(LastSpace),
205 NestedBlockIndent(Indent), BreakBeforeClosingBrace(
false),
206 AvoidBinPacking(AvoidBinPacking), BreakBeforeParameter(
false),
207 NoLineBreak(NoLineBreak), NoLineBreakInOperand(
false),
208 LastOperatorWrapped(
true), ContainsLineBreak(
false),
209 ContainsUnwrappedBuilder(
false), AlignColons(
true),
210 ObjCSelectorNameFound(
false), HasMultipleNestedBlocks(
false),
211 NestedBlockInlined(
false), IsInsideObjCArrayLiteral(
false) {}
239 unsigned FirstLessLess = 0;
242 unsigned QuestionColumn = 0;
245 unsigned ColonPos = 0;
248 unsigned StartOfFunctionCall = 0;
252 unsigned StartOfArraySubscripts = 0;
256 unsigned NestedNameSpecifierContinuation = 0;
260 unsigned CallContinuation = 0;
265 unsigned VariablePos = 0;
333 if (Indent != Other.
Indent)
334 return Indent < Other.
Indent;
342 return BreakBeforeClosingBrace;
346 return AvoidBinPacking;
348 return BreakBeforeParameter;
352 return LastOperatorWrapped;
364 return ContainsLineBreak;
366 return ContainsUnwrappedBuilder;
368 return NestedBlockInlined;
430 if (Column != Other.
Column)
431 return Column < Other.
Column;
432 if (LineContainsContinuedForLoopSection !=
434 return LineContainsContinuedForLoopSection;
436 return NoContinuation;
445 return Stack < Other.
Stack;
Contains functions for text encoding manipulation.
const AnnotatedLine * Line
Dataflow Directional Tag Classes.
raw_ostream & Indent(raw_ostream &Out, const unsigned int Space, bool IsDot)
This class handles loading and caching of source files into memory.