Home
last modified time | relevance | path

Searched refs:FormatToken (Results 1 – 25 of 31) sorted by relevance

12

/freebsd/contrib/llvm-project/clang/lib/Format/
H A DMacros.h82 using ArgsList = ArrayRef<SmallVector<FormatToken *, 8>>;
99 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
118 SmallVector<FormatToken *, 8>
119 expand(FormatToken *ID, std::optional<ArgsList> OptionalArgs) const;
129 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
180 const llvm::DenseMap<FormatToken *, std::unique_ptr<UnwrappedLine>>
228 void add(FormatToken *Token, FormatToken *ExpandedParent, bool First,
230 void prepareParent(FormatToken *ExpandedParent, bool First, unsigned Level);
231 FormatToken *getParentInResult(FormatToken *Parent);
232 void reconstruct(FormatToken *Token);
[all …]
H A DFormatTokenSource.h34 virtual FormatToken *getNextToken() = 0;
41 virtual FormatToken *getPreviousToken() = 0;
45 virtual FormatToken *peekNextToken(bool SkipComment = false) = 0;
60 virtual FormatToken *setPosition(unsigned Position) = 0;
74 virtual FormatToken *insertTokens(ArrayRef<FormatToken *> Tokens) = 0;
76 [[nodiscard]] FormatToken *getNextNonComment() { in getNextNonComment()
77 FormatToken *Tok; in getNextNonComment()
88 IndexedTokenSource(ArrayRef<FormatToken *> Tokens) in IndexedTokenSource()
91 FormatToken *getNextToken() override { in getNextToken()
107 FormatToken *getPreviousToken() override { in getPreviousToken()
[all …]
H A DUnwrappedLineParser.h105 unsigned FirstStartColumn, ArrayRef<FormatToken *> Tokens,
107 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
123 bool parseLevel(const FormatToken *OpeningBrace = nullptr,
125 FormatToken **IfLeftBrace = nullptr);
127 const FormatToken *OpeningBrace = nullptr) const;
128 FormatToken *parseBlock(bool MustBeDeclaration = false,
141 void parseStructuralElement(const FormatToken *OpeningBrace = nullptr,
143 FormatToken **IfLeftBrace = nullptr,
155 bool isBlockBegin(const FormatToken &Tok) const;
156 FormatToken *parseIfThenElse(IfStmtKind *IfKind, bool KeepBraces = false,
[all …]
H A DTokenAnnotator.h70 FormatToken *Current = First; in AnnotatedLine()
87 void addChildren(const UnwrappedLineNode &Node, FormatToken *Current) { in addChildren()
107 FormatToken *Current = First; in ~AnnotatedLine()
162 FormatToken *getFirstNonComment() const { in getFirstNonComment()
167 FormatToken *getLastNonComment() const { in getLastNonComment()
172 FormatToken *First;
173 FormatToken *Last;
239 unsigned splitPenalty(const AnnotatedLine &Line, const FormatToken &Tok,
242 bool spaceRequiredBeforeParens(const FormatToken &Right) const;
244 bool spaceRequiredBetween(const AnnotatedLine &Line, const FormatToken &Left,
[all …]
H A DFormatTokenLexer.h39 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
42 ArrayRef<FormatToken *> lex();
71 bool precedesOperand(FormatToken *Tok);
73 bool canPrecedeRegexLiteral(FormatToken *Prev);
111 FormatToken *getStashedToken();
113 FormatToken *getNextToken();
115 FormatToken *FormatTok;
128 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
131 SmallVector<FormatToken *, 16> Tokens;
150 void readRawToken(FormatToken &Tok);
H A DMacroExpander.cpp33 SmallVector<FormatToken *, 8> Params;
34 SmallVector<FormatToken *, 8> Body;
47 DefinitionParser(ArrayRef<FormatToken *> Tokens) : Tokens(Tokens) { in DefinitionParser()
113 FormatToken *Current = nullptr;
115 ArrayRef<FormatToken *> Tokens;
121 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in MacroExpander()
163 SmallVector<FormatToken *, 8>
164 MacroExpander::expand(FormatToken *ID, in expand()
176 SmallVector<FormatToken *, 8> Result; in expand()
181 auto pushToken = [&](FormatToken *Tok) { in expand()
[all …]
H A DQualifierAlignmentFixer.cpp68 const FormatToken *First) { in removeToken()
76 const FormatToken *First, in insertQualifierAfter()
89 const FormatToken *First, in insertQualifierBefore()
113 tooling::Replacements &Fixes, const FormatToken *First, in rotateTokens()
114 const FormatToken *Last, bool Left) { in rotateTokens()
155 isConfiguredQualifier(const FormatToken *const Tok, in isConfiguredQualifier()
160 static bool isQualifier(const FormatToken *const Tok) { in isQualifier()
178 const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight( in analyzeRight()
180 tooling::Replacements &Fixes, const FormatToken *const Tok, in analyzeRight()
194 const FormatToken *PreviousCheck = Tok->getPreviousNonComment(); in analyzeRight()
[all …]
H A DMacroCallReconstructor.cpp33 FormatToken *Parent = nullptr) { in forEachToken()
45 const llvm::DenseMap<FormatToken *, std::unique_ptr<UnwrappedLine>> in MacroCallReconstructor() argument
55 forEachToken(Line, [&](FormatToken *Token, FormatToken *Parent, bool First, in addLine()
73 void MacroCallReconstructor::add(FormatToken *Token, in add()
74 FormatToken *ExpandedParent, bool First, in add()
131 void MacroCallReconstructor::prepareParent(FormatToken *ExpandedParent, in prepareParent()
139 FormatToken *Parent = getParentInResult(ExpandedParent); in prepareParent()
143 FormatToken *OpenMacroParent = nullptr; in prepareParent()
193 FormatToken *MacroCallReconstructor::getParentInResult(FormatToken *Parent) { in getParentInResult()
194 FormatToken *Mapped = SpelledParentToReconstructedParent.lookup(Parent); in getParentInResult()
[all …]
H A DQualifierAlignmentFixer.h36 bool isQualifierOrType(const FormatToken *Tok, const LangOptions &LangOpts);
37 bool isConfiguredQualifierOrType(const FormatToken *Tok,
42 bool isPossibleMacro(const FormatToken *Tok);
68 const FormatToken *analyzeRight(const SourceManager &SourceMgr,
71 const FormatToken *Tok,
75 const FormatToken *analyzeLeft(const SourceManager &SourceMgr,
78 const FormatToken *Tok,
H A DFormatToken.cpp43 bool FormatToken::isTypeName(const LangOptions &LangOpts) const { in isTypeName()
50 bool FormatToken::isTypeOrIdentifier(const LangOptions &LangOpts) const { in isTypeOrIdentifier()
54 bool FormatToken::isBlockIndentedInitRBrace(const FormatStyle &Style) const { in isBlockIndentedInitRBrace()
70 bool FormatToken::opensBlockOrBlockTypeList(const FormatStyle &Style) const { in opensBlockOrBlockTypeList()
85 void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} in precomputeFormattingInfos()
97 const FormatToken *LBrace = in formatAfterToken()
159 static unsigned CodePointsBetween(const FormatToken *Begin, in CodePointsBetween()
160 const FormatToken *End) { in CodePointsBetween()
165 void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { in precomputeFormattingInfos()
190 FormatToken *ItemBegin = Token->Next; in precomputeFormattingInfos()
[all …]
H A DContinuationIndenter.h28 struct FormatToken;
107 unsigned reformatRawStringLiteral(const FormatToken &Current,
114 unsigned handleEndOfLine(const FormatToken &Current, LineState &State,
119 std::optional<FormatStyle> getRawStringStyle(const FormatToken &Current,
140 std::pair<unsigned, bool> breakProtrudingToken(const FormatToken &Current,
148 createBreakableToken(const FormatToken &Current, LineState &State,
178 unsigned addMultilineToken(const FormatToken &Current, LineState &State);
198 ParenState(const FormatToken *Tok, unsigned Indent, unsigned LastSpace, in ParenState()
218 const FormatToken *Tok;
421 FormatToken *NextToken;
H A DFormatToken.h252 struct FormatToken;
291 llvm::SmallVector<FormatToken *, 1> ExpandedFrom;
306 struct FormatToken { struct
307 FormatToken() in FormatToken() function
569 FormatToken *NextOperator = nullptr; argument
572 FormatToken *MatchingParen = nullptr; argument
575 FormatToken *Previous = nullptr; argument
578 FormatToken *Next = nullptr; argument
840 [[nodiscard]] FormatToken *getPreviousNonComment() const { in getPreviousNonComment() argument
841 FormatToken *Tok = Previous; in getPreviousNonComment()
[all …]
H A DBreakableToken.h29 bool switchesFormatting(const FormatToken &Token);
236 BreakableToken(const FormatToken &Tok, bool InPPDirective, in BreakableToken()
241 const FormatToken &Tok;
253 BreakableStringLiteral(const FormatToken &Tok, unsigned StartColumn,
302 const FormatToken &Tok, QuoteStyleType QuoteStyle, bool UnindentPlus,
333 BreakableComment(const FormatToken &Token, unsigned StartColumn,
348 const FormatToken &tokenAt(unsigned LineIndex) const;
370 SmallVector<FormatToken *, 16> Tokens;
402 BreakableBlockComment(const FormatToken &Token, unsigned StartColumn,
481 BreakableLineCommentSection(const FormatToken &Token, unsigned StartColumn,
[all …]
H A DObjCPropertyAttributeOrderFixer.cpp37 const FormatToken *BeginTok, const FormatToken *EndTok) { in sortPropertyAttributes()
155 tooling::Replacements &Fixes, const FormatToken *Tok) { in analyzeObjCPropertyDecl()
159 const FormatToken *const PropertyTok = Tok->Next; in analyzeObjCPropertyDecl()
164 const FormatToken *const LParenTok = PropertyTok->getNextNonComment(); in analyzeObjCPropertyDecl()
169 const FormatToken *const RParenTok = LParenTok->MatchingParen; in analyzeObjCPropertyDecl()
190 FormatToken *First = Line->First; in analyze()
H A DAffectedRangeManager.h22 struct FormatToken;
42 bool affectsTokenRange(const FormatToken &First, const FormatToken &Last,
47 bool affectsLeadingEmptyLines(const FormatToken &Tok);
H A DTokenAnnotator.cpp26 static bool mustBreakAfterAttributes(const FormatToken &Tok, in mustBreakAfterAttributes()
58 static bool canBeObjCSelectorComponent(const FormatToken &Tok) { in canBeObjCSelectorComponent()
65 static bool isLambdaParameterList(const FormatToken *Left) { in isLambdaParameterList()
81 static bool isKeywordWithCondition(const FormatToken &Tok) { in isKeywordWithCondition()
87 static bool isCppAttribute(bool IsCpp, const FormatToken &Tok) { in isCppAttribute()
93 const FormatToken *AttrTok = Tok.Next->Next; in isCppAttribute()
136 ScopeType getScopeType(const FormatToken &Token) const { in getScopeType()
258 if (FormatToken *Previous = CurrentToken->getPreviousNonComment()) { in parseAngle()
308 FormatToken &OpeningParen = *CurrentToken->Previous; in parseParens()
310 FormatToken *PrevNonComment = OpeningParen.getPreviousNonComment(); in parseParens()
[all …]
H A DUnwrappedLineParser.cpp157 ArrayRef<FormatToken *> Tokens, UnwrappedLineConsumer &Callback, in UnwrappedLineParser()
158 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in UnwrappedLineParser()
191 for (FormatToken *Token : AllTokens) in reset()
338 const FormatToken *Previous = Tokens->getPreviousToken(); in precededByCommentOrPPDirective()
349 bool UnwrappedLineParser::parseLevel(const FormatToken *OpeningBrace, in parseLevel()
351 FormatToken **IfLeftBrace) { in parseLevel()
356 FormatToken *IfLBrace = nullptr; in parseLevel()
420 const FormatToken *Next = Tokens->peekNextToken(); in parseLevel()
486 FormatToken *Tok = FormatTok; in calculateBraceTypes()
487 const FormatToken *PrevTok = Tok->Previous; in calculateBraceTypes()
[all …]
H A DContinuationIndenter.cpp41 static bool shouldUnindentNextOperator(const FormatToken &Tok) { in shouldUnindentNextOperator()
42 const FormatToken *Previous = Tok.getPreviousNonComment(); in shouldUnindentNextOperator()
49 static unsigned getLengthToMatchingParen(const FormatToken &Tok, in getLengthToMatchingParen()
91 FormatToken *End = Tok.MatchingParen; in getLengthToMatchingParen()
98 auto FindParenState = [&](const FormatToken *LBrace) -> const ParenState * { in getLengthToMatchingParen()
119 static unsigned getLengthToNextOperator(const FormatToken &Tok) { in getLengthToNextOperator()
127 static bool startsSegmentOfBuilderTypeCall(const FormatToken &Tok) { in startsSegmentOfBuilderTypeCall()
132 static bool isAlignableBinaryOperator(const FormatToken &Token) { in isAlignableBinaryOperator()
141 static bool startsNextOperand(const FormatToken &Current) { in startsNextOperand()
148 static bool mustBreakBinaryOperation(const FormatToken &Current, in mustBreakBinaryOperation()
[all …]
H A DAffectedRangeManager.cpp36 FormatToken *Last = Line->Last; in computeAffectedLines()
72 bool AffectedRangeManager::affectsTokenRange(const FormatToken &First, in affectsTokenRange()
73 const FormatToken &Last, in affectsTokenRange()
84 bool AffectedRangeManager::affectsLeadingEmptyLines(const FormatToken &Tok) { in affectsLeadingEmptyLines()
120 for (FormatToken *Tok = Line->First; Tok; Tok = Tok->Next) { in nonPPLineAffected()
H A DWhitespaceManager.h52 void replaceWhitespace(FormatToken &Tok, unsigned Newlines, unsigned Spaces,
60 void addUntouchableToken(const FormatToken &Tok, bool InPPDirective);
78 void replaceWhitespaceInToken(const FormatToken &Tok, unsigned Offset,
109 Change(const FormatToken &Tok, bool CreateReplacement,
119 const FormatToken *Tok;
H A DDefinitionBlockSeparator.cpp37 auto GetBracketLevelChange = [](const FormatToken *Tok) { in separateBlocks()
51 for (const FormatToken *CurrentToken = Line->First; CurrentToken; in separateBlocks()
80 FormatToken *TargetToken = nullptr; in separateBlocks()
84 const auto IsAccessSpecifierToken = [](const FormatToken *Token) { in separateBlocks()
121 for (const FormatToken *CurrentToken = CurrentLine->First; CurrentToken; in separateBlocks()
H A DUnwrappedLineFormatter.cpp24 const FormatToken *Next = Line.First->getNextNonComment(); in startsExternCBlock()
25 const FormatToken *NextNext = Next ? Next->getNextNonComment() : nullptr; in startsExternCBlock()
30 bool isRecordLBrace(const FormatToken &Tok) { in isRecordLBrace()
166 const FormatToken *
179 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
186 const FormatToken *NamespaceToken = in getMatchingNamespaceTokenText()
266 const FormatToken *Tok = PreviousLine->First; in tryFitMultipleLinesInOne()
460 const FormatToken *Previous = PreviousLine->Last; in tryFitMultipleLinesInOne()
468 const FormatToken *PreviousPrevious = in tryFitMultipleLinesInOne()
536 const FormatToken *First = TheLine->First; in tryFitMultipleLinesInOne()
[all …]
H A DFormatTokenLexer.cpp29 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in FormatTokenLexer()
87 ArrayRef<FormatToken *> FormatTokenLexer::lex() { in lex()
667 bool FormatTokenLexer::precedesOperand(FormatToken *Tok) { in precedesOperand()
680 bool FormatTokenLexer::canPrecedeRegexLiteral(FormatToken *Prev) { in canPrecedeRegexLiteral()
736 FormatToken *RegexToken = Tokens.back(); in tryParseJSRegexLiteral()
740 FormatToken *Prev = nullptr; in tryParseJSRegexLiteral()
741 for (FormatToken *FT : llvm::drop_begin(llvm::reverse(Tokens))) { in tryParseJSRegexLiteral()
850 FormatToken *CSharpStringLiteral = Tokens.back(); in handleCSharpVerbatimAndInterpolatedStrings()
909 FormatToken *MultiLineString = Tokens.back(); in handleTableGenMultilineString()
940 FormatToken *Tok = Tokens.back(); in handleTableGenNumericLikeIdentifier()
[all …]
H A DTokenAnalyzer.cpp100 llvm::SpecificBumpPtrAllocator<FormatToken> Allocator; in process()
105 ArrayRef<FormatToken *> Toks(Lex.lex()); in process()
106 SmallVector<FormatToken *, 10> Tokens(Toks); in process()
H A DSortJavaScriptImports.cpp216 FormatToken *Current = nullptr;
217 FormatToken *LineEnd = nullptr;
219 FormatToken invalidToken;
225 FormatToken *skipComments(FormatToken *Tok) { in skipComments()

12