Home
last modified time | relevance | path

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

12

/openbsd-src/gnu/llvm/clang/lib/Format/
H A DMacros.h88 using ArgsList = llvm::ArrayRef<llvm::SmallVector<FormatToken *, 8>>;
105 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
118 llvm::SmallVector<FormatToken *, 8> expand(FormatToken *ID,
129 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
179 const llvm::DenseMap<FormatToken *, std::unique_ptr<UnwrappedLine>>
227 void add(FormatToken *Token, FormatToken *ExpandedParent, bool First);
228 void prepareParent(FormatToken *ExpandedParent, bool First);
229 FormatToken *getParentInResult(FormatToken *Parent);
230 void reconstruct(FormatToken *Token);
231 void startReconstruction(FormatToken *Token);
[all …]
H A DUnwrappedLineParser.h92 unsigned FirstStartColumn, ArrayRef<FormatToken *> Tokens,
108 bool parseLevel(const FormatToken *OpeningBrace = nullptr,
112 FormatToken **IfLeftBrace = nullptr);
114 const FormatToken *OpeningBrace = nullptr) const;
115 FormatToken *parseBlock(bool MustBeDeclaration = false,
134 FormatToken **IfLeftBrace = nullptr,
146 bool isBlockBegin(const FormatToken &Tok) const;
147 FormatToken *parseIfThenElse(IfStmtKind *IfKind, bool KeepBraces = false);
162 void parseRequiresClause(FormatToken *RequiresToken);
163 void parseRequiresExpression(FormatToken *RequiresToken);
[all …]
H A DTokenAnnotator.h58 FormatToken *Current = First; in AnnotatedLine()
76 FormatToken *Current = First; in ~AnnotatedLine()
126 FormatToken *First;
127 FormatToken *Last;
186 unsigned splitPenalty(const AnnotatedLine &Line, const FormatToken &Tok,
189 bool spaceRequiredBeforeParens(const FormatToken &Right) const;
191 bool spaceRequiredBetween(const AnnotatedLine &Line, const FormatToken &Left,
192 const FormatToken &Right) const;
195 const FormatToken &Right) const;
198 const FormatToken &Right) const;
[all …]
H A DNamespaceEndCommentsFixer.cpp29 const FormatToken *
30 processTokens(const FormatToken *Tok, tok::TokenKind StartTok, in processTokens()
32 llvm::function_ref<void(const FormatToken *)> Fn) { in processTokens()
48 const FormatToken *skipAttribute(const FormatToken *Tok) { in skipAttribute()
62 std::string computeName(const FormatToken *NamespaceTok) { in computeName()
67 const FormatToken *Tok = NamespaceTok->getNextNonComment(); in computeName()
87 const FormatToken *FirstNSTok = nullptr; in computeName()
101 auto AddToken = [&name](const FormatToken *Tok) { name += Tok->TokenText; }; in computeName()
131 const FormatToken *TokAfterAttr = skipAttribute(Tok); in computeName()
143 const FormatToken *NamespaceTok, in computeEndCommentText()
[all …]
H A DFormatTokenLexer.h43 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
46 ArrayRef<FormatToken *> lex();
73 bool precedesOperand(FormatToken *Tok);
75 bool canPrecedeRegexLiteral(FormatToken *Prev);
104 FormatToken *getStashedToken();
106 FormatToken *getNextToken();
108 FormatToken *FormatTok;
121 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
124 SmallVector<FormatToken *, 16> Tokens;
139 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()
156 llvm::SmallVector<FormatToken *, 8> MacroExpander::expand(FormatToken *ID, in expand()
159 SmallVector<FormatToken *, 8> Result; in expand()
166 auto pushToken = [&](FormatToken *Tok) { in expand()
173 auto expandArgument = [&](FormatToken *Tok) -> bool { in expand()
[all …]
H A DQualifierAlignmentFixer.cpp121 const FormatToken *First) { in removeToken()
129 const FormatToken *First, in insertQualifierAfter()
131 FormatToken *Next = First->Next; in insertQualifierAfter()
144 const FormatToken *First, in insertQualifierBefore()
168 tooling::Replacements &Fixes, const FormatToken *First, in rotateTokens()
169 const FormatToken *Last, bool Left) { in rotateTokens()
207 const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight( in analyzeRight()
209 tooling::Replacements &Fixes, const FormatToken *Tok, in analyzeRight()
221 [&](const FormatToken *Tok, in analyzeRight()
222 const FormatToken *StartTemplate) -> const FormatToken * { 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()
74 void MacroCallReconstructor::add(FormatToken *Token, in add()
75 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 DContinuationIndenter.h33 struct FormatToken;
112 unsigned reformatRawStringLiteral(const FormatToken &Current,
119 unsigned handleEndOfLine(const FormatToken &Current, LineState &State,
124 std::optional<FormatStyle> getRawStringStyle(const FormatToken &Current,
145 std::pair<unsigned, bool> breakProtrudingToken(const FormatToken &Current,
153 createBreakableToken(const FormatToken &Current, LineState &State,
183 unsigned addMultilineToken(const FormatToken &Current, LineState &State);
203 ParenState(const FormatToken *Tok, unsigned Indent, unsigned LastSpace, in ParenState()
222 const FormatToken *Tok;
421 FormatToken *NextToken;
H A DUnwrappedLineParser.cpp36 virtual FormatToken *getNextToken() = 0;
40 virtual FormatToken *getPreviousToken() = 0;
44 virtual FormatToken *peekNextToken(bool SkipComment = false) = 0;
56 virtual FormatToken *setPosition(unsigned Position) = 0;
115 static bool isLineComment(const FormatToken &FormatTok) { in isLineComment()
122 static bool continuesLineComment(const FormatToken &FormatTok, in continuesLineComment()
123 const FormatToken *Previous, in continuesLineComment()
124 const FormatToken *MinColumnToken) { in continuesLineComment()
137 FormatToken *&ResetToken) in ScopedMacroState()
157 FormatToken *getNextToken() override { in getNextToken()
[all …]
H A DBreakableToken.h32 bool switchesFormatting(const FormatToken &Token);
234 BreakableToken(const FormatToken &Tok, bool InPPDirective, in BreakableToken()
239 const FormatToken &Tok;
251 BreakableStringLiteral(const FormatToken &Tok, unsigned StartColumn,
292 BreakableComment(const FormatToken &Token, unsigned StartColumn,
307 const FormatToken &tokenAt(unsigned LineIndex) const;
329 SmallVector<FormatToken *, 16> Tokens;
359 BreakableBlockComment(const FormatToken &Token, unsigned StartColumn,
438 BreakableLineCommentSection(const FormatToken &Token, unsigned StartColumn,
493 FormatToken *LastLineTok = nullptr;
H A DQualifierAlignmentFixer.h75 const FormatToken *analyzeRight(const SourceManager &SourceMgr,
78 const FormatToken *Tok,
82 const FormatToken *analyzeLeft(const SourceManager &SourceMgr,
85 const FormatToken *Tok,
90 static bool isQualifierOrType(const FormatToken *Tok,
94 static bool isPossibleMacro(const FormatToken *Tok);
H A DFormatToken.cpp39 bool FormatToken::isSimpleTypeSpecifier() const { in isSimpleTypeSpecifier()
74 bool FormatToken::isTypeOrIdentifier() const { in isTypeOrIdentifier()
78 bool FormatToken::opensBlockOrBlockTypeList(const FormatStyle &Style) const { in opensBlockOrBlockTypeList()
94 void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} in precomputeFormattingInfos()
106 const FormatToken *LBrace = in formatAfterToken()
168 static unsigned CodePointsBetween(const FormatToken *Begin, in CodePointsBetween()
169 const FormatToken *End) { in CodePointsBetween()
174 void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { in precomputeFormattingInfos()
199 FormatToken *ItemBegin = Token->Next; in precomputeFormattingInfos()
223 const FormatToken *ItemEnd = nullptr; in precomputeFormattingInfos()
[all …]
H A DAffectedRangeManager.h22 struct FormatToken;
42 bool affectsTokenRange(const FormatToken &First, const FormatToken &Last,
47 bool affectsLeadingEmptyLines(const FormatToken &Tok);
H A DTokenAnnotator.cpp47 static bool canBeObjCSelectorComponent(const FormatToken &Tok) { in canBeObjCSelectorComponent()
53 static bool isLambdaParameterList(const FormatToken *Left) { in isLambdaParameterList()
69 static bool isKeywordWithCondition(const FormatToken &Tok) { in isKeywordWithCondition()
75 static bool isCppAttribute(bool IsCpp, const FormatToken &Tok) { in isCppAttribute()
81 const FormatToken *AttrTok = Tok.Next->Next; in isCppAttribute()
128 const FormatToken &Previous = *CurrentToken->Previous; // The '<'. in parseAngle()
140 FormatToken *Left = CurrentToken->Previous; in parseAngle()
216 if (FormatToken *Previous = CurrentToken->getPreviousNonComment()) { in parseAngle()
255 FormatToken &OpeningParen = *CurrentToken->Previous; in parseParens()
257 FormatToken *PrevNonComment = OpeningParen.getPreviousNonComment(); in parseParens()
[all …]
H A DFormatToken.h192 struct FormatToken;
231 llvm::SmallVector<FormatToken *, 1> ExpandedFrom;
246 struct FormatToken { struct
247 FormatToken() in FormatToken() function
489 FormatToken *NextOperator = nullptr; argument
492 FormatToken *MatchingParen = nullptr; argument
495 FormatToken *Previous = nullptr; argument
498 FormatToken *Next = nullptr; argument
738 [[nodiscard]] FormatToken *getPreviousNonComment() const { in getPreviousNonComment() argument
739 FormatToken *Tok = Previous; in getPreviousNonComment()
[all …]
H A DContinuationIndenter.cpp40 static unsigned getLengthToMatchingParen(const FormatToken &Tok, in getLengthToMatchingParen()
82 FormatToken *End = Tok.MatchingParen; in getLengthToMatchingParen()
89 auto FindParenState = [&](const FormatToken *LBrace) -> const ParenState * { in getLengthToMatchingParen()
110 static unsigned getLengthToNextOperator(const FormatToken &Tok) { in getLengthToNextOperator()
118 static bool startsSegmentOfBuilderTypeCall(const FormatToken &Tok) { in startsSegmentOfBuilderTypeCall()
123 static bool startsNextParameter(const FormatToken &Current, in startsNextParameter()
125 const FormatToken &Previous = *Current.Previous; in startsNextParameter()
140 static bool opensProtoMessageField(const FormatToken &LessTok, in opensProtoMessageField()
281 const FormatToken &Current = *State.NextToken; in canBreak()
282 const FormatToken &Previous = *Current.Previous; in canBreak()
[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 DUnwrappedLineFormatter.cpp23 const FormatToken *Next = Line.First->getNextNonComment(); in startsExternCBlock()
24 const FormatToken *NextNext = Next ? Next->getNextNonComment() : nullptr; in startsExternCBlock()
29 bool isRecordLBrace(const FormatToken &Tok) { in isRecordLBrace()
111 int getIndentOffset(const FormatToken &RootToken) { in getIndentOffset()
180 const FormatToken *getMatchingNamespaceToken( in getMatchingNamespaceToken()
193 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
200 const FormatToken *NamespaceToken = in getMatchingNamespaceTokenText()
281 const FormatToken *Tok = PreviousLine->First; in tryFitMultipleLinesInOne()
342 const FormatToken *LastNonComment = Line->Last; in tryFitMultipleLinesInOne()
359 const FormatToken *FirstNonComment = TheLine->First; in tryFitMultipleLinesInOne()
[all …]
H A DWhitespaceManager.h57 void replaceWhitespace(FormatToken &Tok, unsigned Newlines, unsigned Spaces,
65 void addUntouchableToken(const FormatToken &Tok, bool InPPDirective);
83 void replaceWhitespaceInToken(const FormatToken &Tok, unsigned Offset,
114 Change(const FormatToken &Tok, bool CreateReplacement,
124 const FormatToken *Tok;
H A DFormatTokenLexer.cpp28 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, in FormatTokenLexer()
76 ArrayRef<FormatToken *> FormatTokenLexer::lex() { in lex()
483 SmallVectorImpl<FormatToken *>::const_iterator First = in tryMergeTokens()
496 SmallVectorImpl<FormatToken *>::const_iterator First = Tokens.end() - Count; in tryMergeTokens()
522 bool FormatTokenLexer::precedesOperand(FormatToken *Tok) { in precedesOperand()
535 bool FormatTokenLexer::canPrecedeRegexLiteral(FormatToken *Prev) { in canPrecedeRegexLiteral()
561 FormatToken *RegexToken = Tokens.back(); in tryParseJSRegexLiteral()
565 FormatToken *Prev = nullptr; in tryParseJSRegexLiteral()
566 for (FormatToken *FT : llvm::drop_begin(llvm::reverse(Tokens))) { in tryParseJSRegexLiteral()
675 FormatToken *CSharpStringLiteral = Tokens.back(); in handleCSharpVerbatimAndInterpolatedStrings()
[all …]
H A DDefinitionBlockSeparator.cpp38 auto GetBracketLevelChange = [](const FormatToken *Tok) { in separateBlocks()
52 for (const FormatToken *CurrentToken = Line->First; CurrentToken; in separateBlocks()
81 FormatToken *TargetToken = nullptr; in separateBlocks()
85 const auto IsAccessSpecifierToken = [](const FormatToken *Token) { in separateBlocks()
122 for (const FormatToken *CurrentToken = CurrentLine->First; CurrentToken; in separateBlocks()
H A DTokenAnalyzer.cpp103 llvm::SpecificBumpPtrAllocator<FormatToken> Allocator; in process()
109 ArrayRef<FormatToken *> Toks(Lex.lex()); in process()
110 SmallVector<FormatToken *, 10> Tokens(Toks.begin(), Toks.end()); in process()
H A DSortJavaScriptImports.cpp220 FormatToken *Current;
221 FormatToken *LineEnd;
223 FormatToken invalidToken;
229 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()
295 BreakableComment::BreakableComment(const FormatToken &Token, in BreakableComment()
332 const FormatToken &BreakableComment::tokenAt(unsigned LineIndex) const { in tokenAt()
367 const FormatToken &Token, unsigned StartColumn, in BreakableBlockComment()
752 const FormatToken &Token, unsigned StartColumn, bool InPPDirective, in BreakableLineCommentSection()
757 FormatToken *LineTok = nullptr; in BreakableLineCommentSection()
762 for (const FormatToken *CurrentTok = &Tok; in BreakableLineCommentSection()

12