Lines Matching refs:Line
61 void printLine(llvm::raw_ostream &OS, const UnwrappedLine &Line, in printLine() argument
63 OS << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn in printLine()
64 << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; in printLine()
66 for (std::list<UnwrappedLineNode>::const_iterator I = Line.Tokens.begin(), in printLine()
67 E = Line.Tokens.end(); in printLine()
90 LLVM_ATTRIBUTE_UNUSED static void printDebugInfo(const UnwrappedLine &Line) { in printDebugInfo() argument
91 printLine(llvm::dbgs(), Line); in printDebugInfo()
96 ScopedDeclarationState(UnwrappedLine &Line, llvm::BitVector &Stack, in ScopedDeclarationState() argument
98 : Line(Line), Stack(Stack) { in ScopedDeclarationState()
99 Line.MustBeDeclaration = MustBeDeclaration; in ScopedDeclarationState()
105 Line.MustBeDeclaration = Stack.back(); in ~ScopedDeclarationState()
107 Line.MustBeDeclaration = true; in ~ScopedDeclarationState()
111 UnwrappedLine &Line; member in clang::format::__anon1d1aefd40111::ScopedDeclarationState
136 ScopedMacroState(UnwrappedLine &Line, FormatTokenSource *&TokenSource, in ScopedMacroState() argument
138 : Line(Line), TokenSource(TokenSource), ResetToken(ResetToken), in ScopedMacroState()
139 PreviousLineLevel(Line.Level), PreviousTokenSource(TokenSource), in ScopedMacroState()
144 Line.Level = 0; in ScopedMacroState()
145 Line.InPPDirective = true; in ScopedMacroState()
152 Line.InPPDirective = false; in ~ScopedMacroState()
153 Line.InMacroBody = false; in ~ScopedMacroState()
154 Line.Level = PreviousLineLevel; in ~ScopedMacroState()
196 UnwrappedLine &Line; member in clang::format::__anon1d1aefd40111::ScopedMacroState
215 else if (!Parser.Line->Tokens.empty()) in ScopedLineState()
216 Parser.CurrentLines = &Parser.Line->Tokens.back().Children; in ScopedLineState()
217 PreBlockLine = std::move(Parser.Line); in ScopedLineState()
218 Parser.Line = std::make_unique<UnwrappedLine>(); in ScopedLineState()
219 Parser.Line->Level = PreBlockLine->Level; in ScopedLineState()
220 Parser.Line->PPLevel = PreBlockLine->PPLevel; in ScopedLineState()
221 Parser.Line->InPPDirective = PreBlockLine->InPPDirective; in ScopedLineState()
222 Parser.Line->InMacroBody = PreBlockLine->InMacroBody; in ScopedLineState()
226 if (!Parser.Line->Tokens.empty()) in ~ScopedLineState()
228 assert(Parser.Line->Tokens.empty()); in ~ScopedLineState()
229 Parser.Line = std::move(PreBlockLine); in ~ScopedLineState()
338 : Line(new UnwrappedLine), MustBreakBeforeNextToken(false), in UnwrappedLineParser()
353 Line.reset(new UnwrappedLine); in reset()
362 Line->FirstStartColumn = FirstStartColumn; in reset()
367 Line->FirstStartColumn = FirstStartColumn; in parse()
380 for (auto &Line : Lines) in parse() local
381 if (Line.InPPDirective && Line.Level > 0) in parse()
382 --Line.Level; in parse()
389 for (const UnwrappedLine &Line : Lines) in parse() local
390 Callback.consumeUnwrappedLine(Line); in parse()
410 bool MustBeDeclaration = !Line->InPPDirective && !Style.isJavaScript(); in parseFile()
411 ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack, in parseFile()
559 if (!Style.RemoveBracesLLVM || Line->InPPDirective || in parseLevel()
597 (Style.isJavaScript() && Line->MustBeDeclaration)) { in parseLevel()
607 (Line->InPPDirective && Line->Level == 1))) { in parseLevel()
608 ++Line->Level; in parseLevel()
686 ScopedMacroState MacroState(*Line, Tokens, NextTok); in calculateBraceTypes()
794 hash_combine(h, i.Line); in computePPHash()
826 AnnotatedLine Line(ParsedLine); in mightFitOnOneLine() local
827 assert(Line.Last == LastToken); in mightFitOnOneLine()
830 Annotator.annotate(Line); in mightFitOnOneLine()
831 Annotator.calculateFormattingInformation(Line); in mightFitOnOneLine()
843 if (const auto *FirstToken = Line.First; FirstToken->is(tok::r_brace)) { in mightFitOnOneLine()
857 assert(!Line.InMacroBody); in mightFitOnOneLine()
858 assert(!Line.InPPDirective); in mightFitOnOneLine()
859 return Line.Level * Style.IndentWidth + Length <= ColumnLimit; in mightFitOnOneLine()
893 ++Line->Level; in parseBlock()
898 const unsigned InitialLevel = Line->Level; in parseBlock()
907 if (Line->Level > 300) in parseBlock()
925 --Line->Level; in parseBlock()
927 ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack, in parseBlock()
930 Line->Level += AddLevels; in parseBlock()
941 Line->Level = InitialLevel; in parseBlock()
1004 Line->Level = InitialLevel; in parseBlock()
1022 Line->MatchingOpeningBlockLineIndex = OpeningLineIndex; in parseBlock()
1033 static bool isGoogScope(const UnwrappedLine &Line) { in isGoogScope() argument
1036 if (Line.Tokens.size() < 4) in isGoogScope()
1038 auto I = Line.Tokens.begin(); in isGoogScope()
1051 static bool isIIFE(const UnwrappedLine &Line, in isIIFE() argument
1057 if (Line.Tokens.size() < 3) in isIIFE()
1059 auto I = Line.Tokens.begin(); in isIIFE()
1099 (isGoogScope(*Line) || isIIFE(*Line, Keywords))); in parseChildBlock()
1101 ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack, in parseChildBlock()
1103 Line->Level += SkipIndent ? 0 : 1; in parseChildBlock()
1106 Line->Level -= SkipIndent ? 0 : 1; in parseChildBlock()
1113 ScopedMacroState MacroState(*Line, Tokens, FormatTok); in parsePPDirective()
1152 size_t Line = CurrentLines->size(); in conditionalCompilationCondition() local
1154 Line += Lines.size(); in conditionalCompilationCondition()
1158 PPStack.push_back({PP_Unreachable, Line}); in conditionalCompilationCondition()
1160 PPStack.push_back({PP_Conditional, Line}); in conditionalCompilationCondition()
1216 for (auto &Line : Lines) { in parsePPIf() local
1217 if (!Line.Tokens.front().Tok->is(tok::comment)) { in parsePPIf()
1272 for (auto &Line : Lines) { in parsePPDefine() local
1273 if (!Line.Tokens.front().Tok->isOneOf(tok::comment, tok::hash)) { in parsePPDefine()
1293 Line->Level += PPBranchLevel + 1; in parsePPDefine()
1295 ++Line->Level; in parsePPDefine()
1297 Line->PPLevel = PPBranchLevel + (IncludeGuard == IG_Defined ? 0 : 1); in parsePPDefine()
1298 assert((int)Line->PPLevel >= 0); in parsePPDefine()
1299 Line->InMacroBody = true; in parsePPDefine()
1310 Line->InPragmaDirective = true; in parsePPPragma()
1319 Line->Level += PPBranchLevel + 1; in parsePPUnknown()
1504 bool HasAt = llvm::any_of(Line->Tokens, [](UnwrappedLineNode &LineNode) { in readTokenWithJavaScriptASI()
1587 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1598 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1605 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1614 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1624 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1646 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1655 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1942 Line->Tokens.front().Tok->is(Keywords.kw_synchronized)) { in parseStructuralElement()
1961 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
1973 Line->MustBeDeclaration) { in parseStructuralElement()
1987 size_t TokenCount = Line->Tokens.size(); in parseStructuralElement()
1989 (TokenCount > 1 || (TokenCount == 1 && !Line->Tokens.front().Tok->is( in parseStructuralElement()
2050 auto I = Line->Tokens.begin(), E = Line->Tokens.end(); in parseStructuralElement()
2060 !Line->MustBeDeclaration) { in parseStructuralElement()
2061 Line->Tokens.begin()->Tok->MustBreakBefore = true; in parseStructuralElement()
2129 if (Style.isJavaScript() && Line->MustBeDeclaration) { in parseStructuralElement()
2225 ++Line->Level; in tryToParsePropertyAccessor()
2228 --Line->Level; in tryToParsePropertyAccessor()
2232 ++Line->Level; in tryToParsePropertyAccessor()
2238 --Line->Level; in tryToParsePropertyAccessor()
2670 static FormatToken *getLastNonComment(const UnwrappedLine &Line) { in getLastNonComment() argument
2671 for (const auto &Token : llvm::reverse(Line.Tokens)) in getLastNonComment()
2681 if (Style.InsertBraces && !Line->InPPDirective && !Line->Tokens.empty() && in parseUnbracedBody()
2684 ? getLastNonComment(*Line) in parseUnbracedBody()
2685 : Line->Tokens.back().Tok; in parseUnbracedBody()
2696 ++Line->Level; in parseUnbracedBody()
2700 assert(!Line->InPPDirective); in parseUnbracedBody()
2715 --Line->Level; in parseUnbracedBody()
2791 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseIfThenElse()
2825 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseIfThenElse()
2846 ++Line->Level; in parseIfThenElse()
2857 --Line->Level; in parseIfThenElse()
2935 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseTryCatch()
2946 ++Line->Level; in parseTryCatch()
2948 --Line->Level; in parseTryCatch()
2975 Line->MustBeDeclaration = false; in parseTryCatch()
2976 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseTryCatch()
3028 ++Line->Level; in parseNamespace()
3042 --Line->Level; in parseNamespace()
3097 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseLoopBody()
3149 ++Line->Level; in parseDoWhile()
3157 unsigned OldLineLevel = Line->Level; in parseLabel()
3158 if (Line->Level > 1 || (!Line->InPPDirective && Line->Level > 0)) in parseLabel()
3159 --Line->Level; in parseLabel()
3161 Line->Level = 0; in parseLabel()
3166 CompoundStatementIndenter Indenter(this, Line->Level, in parseLabel()
3176 ++Line->Level; in parseLabel()
3187 Line->Level = OldLineLevel; in parseLabel()
3213 CompoundStatementIndenter Indenter(this, Style, Line->Level); in parseSwitch()
3218 ++Line->Level; in parseSwitch()
3220 --Line->Level; in parseSwitch()
3708 Line->Level += 1; in parseEnum()
3713 Line->Level -= 1; in parseEnum()
3818 ++Line->Level; in parseJavaEnumBody()
3846 --Line->Level; in parseJavaEnumBody()
4141 if (Line->Tokens.empty()) { in parseJavaScriptEs6ImportExport()
4244 Line->IsContinuation = true; in parseVerilogHierarchyHeader()
4303 auto InitialLevel = Line->Level++; in parseVerilogTable()
4312 Line->Level = InitialLevel; in parseVerilogTable()
4323 auto OrigLevel = Line->Level; in parseVerilogCaseLabel()
4325 if (Line->Level == 0 || (Line->InPPDirective && Line->Level <= 1)) in parseVerilogCaseLabel()
4326 ++Line->Level; in parseVerilogCaseLabel()
4328 --Line->Level; in parseVerilogCaseLabel()
4334 Line->Level = OrigLevel; in parseVerilogCaseLabel()
4338 if (Line->Tokens.empty()) in addUnwrappedLine()
4342 printDebugInfo(*Line); in addUnwrappedLine()
4350 Line->MatchingOpeningBlockLineIndex != UnwrappedLine::kInvalidIndex && in addUnwrappedLine()
4353 CurrentLines->push_back(std::move(*Line)); in addUnwrappedLine()
4354 Line->Tokens.clear(); in addUnwrappedLine()
4355 Line->MatchingOpeningBlockLineIndex = UnwrappedLine::kInvalidIndex; in addUnwrappedLine()
4356 Line->FirstStartColumn = 0; in addUnwrappedLine()
4357 Line->IsContinuation = false; in addUnwrappedLine()
4360 --Line->Level; in addUnwrappedLine()
4374 return (Line->InPPDirective || FormatTok.HasUnescapedNewline) && in isOnNewLine()
4382 const UnwrappedLine &Line, in continuesLineCommentSection() argument
4384 if (Line.Tokens.empty()) in continuesLineCommentSection()
4461 const FormatToken *MinColumnToken = Line.Tokens.front().Tok; in continuesLineCommentSection()
4466 for (const UnwrappedLineNode &Node : Line.Tokens) { in continuesLineCommentSection()
4481 return continuesLineComment(FormatTok, /*Previous=*/Line.Tokens.back().Tok, in continuesLineCommentSection()
4486 bool JustComments = Line->Tokens.empty(); in flushComments()
4497 continuesLineCommentSection(*Tok, *Line, CommentPragmasRegex); in flushComments()
4571 continuesLineCommentSection(*FormatTok, *Line, CommentPragmasRegex); in distributeComments()
4622 while (!Line->InPPDirective && FormatTok->is(tok::hash) && in readToken()
4630 bool SwitchToPreprocessorLines = !Line->Tokens.empty(); in readToken()
4633 static_cast<unsigned>(-LevelDifference) <= Line->Level) && in readToken()
4635 Line->Level += LevelDifference; in readToken()
4641 Line->Level += PPBranchLevel; in readToken()
4651 !Line->InPPDirective) { in readToken()
4669 Line->Tokens.push_back(UnwrappedLineNode(Tok)); in pushToken()
4671 Line->Tokens.back().Tok->MustBreakBefore = true; in pushToken()