@@ -183,9 +183,9 @@ class LevelIndentTracker {
183183 unsigned Indent = 0 ;
184184};
185185
186- const FormatToken *getMatchingNamespaceToken (
187- const AnnotatedLine *Line,
188- const SmallVectorImpl <AnnotatedLine *> &AnnotatedLines) {
186+ const FormatToken *
187+ getMatchingNamespaceToken ( const AnnotatedLine *Line,
188+ const ArrayRef <AnnotatedLine *> &AnnotatedLines) {
189189 if (!Line->startsWith (tok::r_brace))
190190 return nullptr ;
191191 size_t StartLineIndex = Line->MatchingOpeningBlockLineIndex ;
@@ -200,9 +200,9 @@ StringRef getNamespaceTokenText(const AnnotatedLine *Line) {
200200 return NamespaceToken ? NamespaceToken->TokenText : StringRef ();
201201}
202202
203- StringRef getMatchingNamespaceTokenText (
204- const AnnotatedLine *Line,
205- const SmallVectorImpl <AnnotatedLine *> &AnnotatedLines) {
203+ StringRef
204+ getMatchingNamespaceTokenText ( const AnnotatedLine *Line,
205+ const ArrayRef <AnnotatedLine *> &AnnotatedLines) {
206206 const FormatToken *NamespaceToken =
207207 getMatchingNamespaceToken (Line, AnnotatedLines);
208208 return NamespaceToken ? NamespaceToken->TokenText : StringRef ();
@@ -241,8 +241,8 @@ class LineJoiner {
241241 // / Calculates how many lines can be merged into 1 starting at \p I.
242242 unsigned
243243 tryFitMultipleLinesInOne (LevelIndentTracker &IndentTracker,
244- SmallVectorImpl <AnnotatedLine *>::const_iterator I,
245- SmallVectorImpl <AnnotatedLine *>::const_iterator E) {
244+ ArrayRef <AnnotatedLine *>::const_iterator I,
245+ ArrayRef <AnnotatedLine *>::const_iterator E) {
246246 const unsigned Indent = IndentTracker.getIndent ();
247247
248248 // Can't join the last line with anything.
@@ -614,8 +614,8 @@ class LineJoiner {
614614 }
615615
616616 unsigned
617- tryMergeSimplePPDirective (SmallVectorImpl <AnnotatedLine *>::const_iterator I,
618- SmallVectorImpl <AnnotatedLine *>::const_iterator E,
617+ tryMergeSimplePPDirective (ArrayRef <AnnotatedLine *>::const_iterator I,
618+ ArrayRef <AnnotatedLine *>::const_iterator E,
619619 unsigned Limit) {
620620 if (Limit == 0 )
621621 return 0 ;
@@ -626,8 +626,8 @@ class LineJoiner {
626626 return 1 ;
627627 }
628628
629- unsigned tryMergeNamespace (SmallVectorImpl <AnnotatedLine *>::const_iterator I,
630- SmallVectorImpl <AnnotatedLine *>::const_iterator E,
629+ unsigned tryMergeNamespace (ArrayRef <AnnotatedLine *>::const_iterator I,
630+ ArrayRef <AnnotatedLine *>::const_iterator E,
631631 unsigned Limit) {
632632 if (Limit == 0 )
633633 return 0 ;
@@ -692,9 +692,10 @@ class LineJoiner {
692692 return 2 ;
693693 }
694694
695- unsigned tryMergeSimpleControlStatement (
696- SmallVectorImpl<AnnotatedLine *>::const_iterator I,
697- SmallVectorImpl<AnnotatedLine *>::const_iterator E, unsigned Limit) {
695+ unsigned
696+ tryMergeSimpleControlStatement (ArrayRef<AnnotatedLine *>::const_iterator I,
697+ ArrayRef<AnnotatedLine *>::const_iterator E,
698+ unsigned Limit) {
698699 if (Limit == 0 )
699700 return 0 ;
700701 if (Style.BraceWrapping .AfterControlStatement ==
@@ -734,10 +735,9 @@ class LineJoiner {
734735 return 1 ;
735736 }
736737
737- unsigned
738- tryMergeShortCaseLabels (SmallVectorImpl<AnnotatedLine *>::const_iterator I,
739- SmallVectorImpl<AnnotatedLine *>::const_iterator E,
740- unsigned Limit) {
738+ unsigned tryMergeShortCaseLabels (ArrayRef<AnnotatedLine *>::const_iterator I,
739+ ArrayRef<AnnotatedLine *>::const_iterator E,
740+ unsigned Limit) {
741741 if (Limit == 0 || I + 1 == E ||
742742 I[1 ]->First ->isOneOf (tok::kw_case, tok::kw_default)) {
743743 return 0 ;
@@ -768,7 +768,7 @@ class LineJoiner {
768768 if (Line->First ->is (tok::comment)) {
769769 if (Level != Line->Level )
770770 return 0 ;
771- SmallVectorImpl<AnnotatedLine *>::const_iterator J = I + 2 + NumStmts;
771+ const auto * J = I + 2 + NumStmts;
772772 for (; J != E; ++J) {
773773 Line = *J;
774774 if (Line->InPPDirective != InPPDirective)
@@ -789,10 +789,9 @@ class LineJoiner {
789789 return NumStmts;
790790 }
791791
792- unsigned
793- tryMergeSimpleBlock (SmallVectorImpl<AnnotatedLine *>::const_iterator I,
794- SmallVectorImpl<AnnotatedLine *>::const_iterator E,
795- unsigned Limit) {
792+ unsigned tryMergeSimpleBlock (ArrayRef<AnnotatedLine *>::const_iterator I,
793+ ArrayRef<AnnotatedLine *>::const_iterator E,
794+ unsigned Limit) {
796795 // Don't merge with a preprocessor directive.
797796 if (I[1 ]->Type == LT_PreprocessorDirective)
798797 return 0 ;
@@ -974,26 +973,25 @@ class LineJoiner {
974973
975974 // / Returns the modified column limit for \p I if it is inside a macro and
976975 // / needs a trailing '\'.
977- unsigned
978- limitConsideringMacros (SmallVectorImpl<AnnotatedLine *>::const_iterator I,
979- SmallVectorImpl<AnnotatedLine *>::const_iterator E,
980- unsigned Limit) {
976+ unsigned limitConsideringMacros (ArrayRef<AnnotatedLine *>::const_iterator I,
977+ ArrayRef<AnnotatedLine *>::const_iterator E,
978+ unsigned Limit) {
981979 if (I[0 ]->InPPDirective && I + 1 != E &&
982980 !I[1 ]->First ->HasUnescapedNewline && I[1 ]->First ->isNot (tok::eof)) {
983981 return Limit < 2 ? 0 : Limit - 2 ;
984982 }
985983 return Limit;
986984 }
987985
988- bool nextTwoLinesFitInto (SmallVectorImpl <AnnotatedLine *>::const_iterator I,
986+ bool nextTwoLinesFitInto (ArrayRef <AnnotatedLine *>::const_iterator I,
989987 unsigned Limit) {
990988 if (I[1 ]->First ->MustBreakBefore || I[2 ]->First ->MustBreakBefore )
991989 return false ;
992990 return 1 + I[1 ]->Last ->TotalLength + 1 + I[2 ]->Last ->TotalLength <= Limit;
993991 }
994992
995- bool nextNLinesFitInto (SmallVectorImpl <AnnotatedLine *>::const_iterator I,
996- SmallVectorImpl <AnnotatedLine *>::const_iterator E,
993+ bool nextNLinesFitInto (ArrayRef <AnnotatedLine *>::const_iterator I,
994+ ArrayRef <AnnotatedLine *>::const_iterator E,
997995 unsigned Limit) {
998996 unsigned JoinedLength = 0 ;
999997 for (const auto *J = I + 1 ; J != E; ++J) {
@@ -1034,9 +1032,9 @@ class LineJoiner {
10341032
10351033 const FormatStyle &Style;
10361034 const AdditionalKeywords &Keywords;
1037- const SmallVectorImpl <AnnotatedLine *>::const_iterator End;
1035+ const ArrayRef <AnnotatedLine *>::const_iterator End;
10381036
1039- SmallVectorImpl <AnnotatedLine *>::const_iterator Next;
1037+ ArrayRef <AnnotatedLine *>::const_iterator Next;
10401038 const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines;
10411039};
10421040
0 commit comments