Home
last modified time | relevance | path

Searched refs:FormatToken (Results 1 – 25 of 29) 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,
154 bool isBlockBegin(const FormatToken &Tok) const;
155 FormatToken *parseIfThenElse(IfStmtKind *IfKind, bool KeepBraces = false,
[all …]
H A DTokenAnnotator.h68 FormatToken *Current = First; in AnnotatedLine()
85 void addChildren(const UnwrappedLineNode &Node, FormatToken *Current) { in addChildren()
105 FormatToken *Current = First; in ~AnnotatedLine()
155 FormatToken *getFirstNonComment() const { in getFirstNonComment()
160 FormatToken *getLastNonComment() const { in getLastNonComment()
165 FormatToken *First;
166 FormatToken *Last;
231 unsigned splitPenalty(const AnnotatedLine &Line, const FormatToken &Tok,
234 bool spaceRequiredBeforeParens(const FormatToken &Right) const;
236 bool spaceRequiredBetween(const AnnotatedLine &Line, const FormatToken &Left,
[all …]
H A DFormatTokenLexer.h39 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
42 ArrayRef<FormatToken *> lex();
70 bool precedesOperand(FormatToken *Tok);
72 bool canPrecedeRegexLiteral(FormatToken *Prev);
108 FormatToken *getStashedToken();
110 FormatToken *getNextToken();
112 FormatToken *FormatTok;
125 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
128 SmallVector<FormatToken *, 16> Tokens;
145 void readRawToken(FormatToken &Tok);
H A DMacroExpander.cpp36 SmallVector<FormatToken *, 8> Params;
37 SmallVector<FormatToken *, 8> Body;
50 DefinitionParser(ArrayRef<FormatToken *> Tokens) : Tokens(Tokens) { in DefinitionParser()
116 FormatToken *Current = nullptr;
118 ArrayRef<FormatToken *> Tokens;
124 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in MacroExpander()
166 SmallVector<FormatToken *, 8>
167 MacroExpander::expand(FormatToken *ID, in expand()
179 SmallVector<FormatToken *, 8> Result; in expand()
184 auto pushToken = [&](FormatToken *Tok) { in expand()
[all …]
H A DQualifierAlignmentFixer.cpp71 const FormatToken *First) { in removeToken()
79 const FormatToken *First, in insertQualifierAfter()
92 const FormatToken *First, in insertQualifierBefore()
116 tooling::Replacements &Fixes, const FormatToken *First, in rotateTokens()
117 const FormatToken *Last, bool Left) { in rotateTokens()
156 isConfiguredQualifier(const FormatToken *const Tok, in isConfiguredQualifier()
161 static bool isQualifier(const FormatToken *const Tok) { in isQualifier()
179 const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight( in analyzeRight()
181 tooling::Replacements &Fixes, const FormatToken *const Tok, in analyzeRight()
192 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.cpp44 bool FormatToken::isTypeName(const LangOptions &LangOpts) const { in isTypeName()
52 bool FormatToken::isTypeOrIdentifier(const LangOptions &LangOpts) const { in isTypeOrIdentifier()
56 bool FormatToken::isBlockIndentedInitRBrace(const FormatStyle &Style) const { in isBlockIndentedInitRBrace()
71 bool FormatToken::opensBlockOrBlockTypeList(const FormatStyle &Style) const { in opensBlockOrBlockTypeList()
86 void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} in precomputeFormattingInfos()
98 const FormatToken *LBrace = in formatAfterToken()
160 static unsigned CodePointsBetween(const FormatToken *Begin, in CodePointsBetween()
161 const FormatToken *End) { in CodePointsBetween()
166 void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { in precomputeFormattingInfos()
191 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()
217 const FormatToken *Tok;
416 FormatToken *NextToken;
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;
400 BreakableBlockComment(const FormatToken &Token, unsigned StartColumn,
479 BreakableLineCommentSection(const FormatToken &Token, unsigned StartColumn,
[all …]
H A DFormatToken.h244 struct FormatToken;
283 llvm::SmallVector<FormatToken *, 1> ExpandedFrom;
298 struct FormatToken { struct
299 FormatToken() in FormatToken() function
561 FormatToken *NextOperator = nullptr; argument
564 FormatToken *MatchingParen = nullptr; argument
567 FormatToken *Previous = nullptr; argument
570 FormatToken *Next = nullptr; argument
838 [[nodiscard]] FormatToken *getPreviousNonComment() const { in getPreviousNonComment() argument
839 FormatToken *Tok = Previous; in getPreviousNonComment()
[all …]
H A DTokenAnnotator.cpp27 static bool mustBreakAfterAttributes(const FormatToken &Tok, in mustBreakAfterAttributes()
59 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()
137 ScopeType getScopeType(const FormatToken &Token) const { in getScopeType()
175 FormatToken *Left = CurrentToken->Previous; in parseAngle()
260 if (FormatToken *Previous = CurrentToken->getPreviousNonComment()) { in parseAngle()
311 FormatToken &OpeningParen = *CurrentToken->Previous; in parseParens()
[all …]
H A DAffectedRangeManager.h22 struct FormatToken;
42 bool affectsTokenRange(const FormatToken &First, const FormatToken &Last,
47 bool affectsLeadingEmptyLines(const FormatToken &Tok);
H A DUnwrappedLineParser.cpp16 #include "FormatToken.h"
160 ArrayRef<FormatToken *> Tokens, UnwrappedLineConsumer &Callback, in UnwrappedLineParser()
161 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in UnwrappedLineParser()
196 for (FormatToken *Token : AllTokens) in reset()
344 const FormatToken *Previous = Tokens->getPreviousToken(); in precededByCommentOrPPDirective()
355 bool UnwrappedLineParser::parseLevel(const FormatToken *OpeningBrace, in parseLevel()
357 FormatToken **IfLeftBrace) { in parseLevel()
362 FormatToken *IfLBrace = nullptr; in parseLevel()
426 const FormatToken *Next = Tokens->peekNextToken(); in parseLevel()
492 FormatToken *To 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 startsNextParameter(const FormatToken &Current, in startsNextParameter()
134 const FormatToken &Previous = *Current.Previous; in startsNextParameter()
149 static bool opensProtoMessageField(const FormatToken &LessTok, in opensProtoMessageField()
[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 DFormatTokenLexer.cpp28 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in FormatTokenLexer()
79 ArrayRef<FormatToken *> FormatTokenLexer::lex() { in lex()
563 SmallVectorImpl<FormatToken *>::const_iterator First = in tryMergeTokens()
576 SmallVectorImpl<FormatToken *>::const_iterator First = Tokens.end() - Count; in tryMergeTokens()
602 bool FormatTokenLexer::precedesOperand(FormatToken *Tok) { in precedesOperand()
615 bool FormatTokenLexer::canPrecedeRegexLiteral(FormatToken *Prev) { in canPrecedeRegexLiteral()
641 FormatToken *RegexToken = Tokens.back(); in tryParseJSRegexLiteral()
645 FormatToken *Prev = nullptr; in tryParseJSRegexLiteral()
646 for (FormatToken *FT : llvm::drop_begin(llvm::reverse(Tokens))) { in tryParseJSRegexLiteral()
755 FormatToken *CSharpStringLiteral = Tokens.back(); in handleCSharpVerbatimAndInterpolatedStrings()
[all …]
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()
120 auto IsAccessModifier = [&](const FormatToken &RootToken) { in getIndentOffset()
186 const FormatToken *getMatchingNamespaceToken( in getMatchingNamespaceToken()
199 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
206 const FormatToken *NamespaceToken = in getMatchingNamespaceTokenText()
287 const FormatToken *Tok = PreviousLine->First; in tryFitMultipleLinesInOne()
498 const FormatToken *Previous = PreviousLine->Last; in tryFitMultipleLinesInOne()
506 const FormatToken *PreviousPrevious = in tryFitMultipleLinesInOne()
[all …]
H A DTokenAnalyzer.cpp103 llvm::SpecificBumpPtrAllocator<FormatToken> Allocator; in process()
108 ArrayRef<FormatToken *> Toks(Lex.lex()); in process()
109 SmallVector<FormatToken *, 10> Tokens(Toks.begin(), Toks.end()); in process()
H A DSortJavaScriptImports.cpp218 FormatToken *Current = nullptr;
219 FormatToken *LineEnd = nullptr;
221 FormatToken invalidToken;
227 FormatToken *skipComments(FormatToken *Tok) { in skipComments()
H A DBreakableToken.cpp219 bool switchesFormatting(const FormatToken &Token) { in switchesFormatting()
268 const FormatToken &Tok, unsigned StartColumn, StringRef Prefix, in BreakableStringLiteral()
296 const FormatToken &Tok, QuoteStyleType QuoteStyle, bool UnindentPlus, in BreakableStringLiteralUsingOperators()
409 BreakableComment::BreakableComment(const FormatToken &Token, in BreakableComment()
446 const FormatToken &BreakableComment::tokenAt(unsigned LineIndex) const { in tokenAt()
481 const FormatToken &Token, unsigned StartColumn, in BreakableBlockComment()
864 const FormatToken &Token, unsigned StartColumn, bool InPPDirective, in BreakableLineCommentSection()
869 FormatToken *LineTok = nullptr; in BreakableLineCommentSection()
874 for (const FormatToken *CurrentTok = &Tok; in BreakableLineCommentSection()
H A DNamespaceEndCommentsFixer.h29 const FormatToken *

12