Home
last modified time | relevance | path

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

12

/llvm-project-15.0.7/mlir/tools/mlir-tblgen/
H A DFormatGen.cpp21 SMLoc FormatToken::getLoc() const { in getLoc()
80 FormatToken FormatLexer::lexToken() { in lexToken()
180 return FormatToken(kind, str); in lexIdentifier()
213 if (curToken.is(FormatToken::literal)) in parseElement()
219 if (curToken.is(FormatToken::l_paren)) in parseElement()
226 FormatToken tok = curToken; in parseLiteral()
257 FormatToken tok = curToken; in parseVariable()
267 FormatToken tok = curToken; in parseDirective()
271 if (tok.is(FormatToken::kw_custom)) in parseDirective()
304 if (curToken.is(FormatToken::colon)) { in parseOptionalGroup()
[all …]
H A DFormatGen.h38 class FormatToken {
121 FormatToken lexToken();
134 FormatToken lexIdentifier(const char *tokStart);
135 FormatToken lexLiteral(const char *tokStart);
136 FormatToken lexVariable(const char *tokStart);
139 FormatToken formToken(FormatToken::Kind kind, const char *tokStart) { in formToken()
500 FailureOr<FormatToken> parseToken(FormatToken::Kind kind, const Twine &msg) { in parseToken()
503 FormatToken tok = curToken; in parseToken()
510 assert(!curToken.is(FormatToken::eof) && !curToken.is(FormatToken::error) && in consumeToken()
516 FormatToken peekToken() { return curToken; } in peekToken()
[all …]
H A DAttrOrTypeFormatGen.cpp1029 case FormatToken::kw_qualified: in parseDirectiveImpl()
1031 case FormatToken::kw_params: in parseDirectiveImpl()
1033 case FormatToken::kw_struct: in parseDirectiveImpl()
1035 case FormatToken::kw_ref: in parseDirectiveImpl()
1037 case FormatToken::kw_custom: in parseDirectiveImpl()
1047 if (failed(parseToken(FormatToken::l_paren, in parseQualifiedDirective()
1090 if (failed(parseToken(FormatToken::l_paren, in parseStructDirective()
1106 while (peekToken().is(FormatToken::comma)) { in parseStructDirective()
1118 if (failed(parseToken(FormatToken::r_paren, in parseStructDirective()
1132 if (failed(parseToken(FormatToken::l_paren, "expected '('")) || in parseRefDirective()
[all …]
/llvm-project-15.0.7/clang/lib/Format/
H A DMacros.h118 llvm::SmallVector<FormatToken *, 8> expand(FormatToken *ID,
227 void add(FormatToken *Token, FormatToken *ExpandedParent, bool First);
229 FormatToken *getParentInResult(FormatToken *Parent);
230 void reconstruct(FormatToken *Token);
233 void endReconstruction(FormatToken *Token);
259 LineNode(FormatToken *Tok) : Tok(Tok) {} in LineNode()
260 FormatToken *Tok = nullptr;
309 llvm::DenseMap<FormatToken *, FormatToken *>
316 FormatToken *ID;
348 FormatToken *ParentLastToken;
[all …]
H A DUnwrappedLineParser.h100 FormatToken **IfLeftBrace = nullptr);
103 FormatToken *parseBlock(bool MustBeDeclaration = false,
150 void parseRequiresClause(FormatToken *RequiresToken);
202 const FormatToken *NextTok);
206 void pushToken(FormatToken *Tok);
218 bool isOnNewLine(const FormatToken &FormatTok);
235 FormatToken *FormatTok;
267 ArrayRef<FormatToken *> AllTokens;
325 FormatToken *IncludeGuardToken;
338 UnwrappedLineNode(FormatToken *Tok) : Tok(Tok) {} in UnwrappedLineNode()
[all …]
H A DTokenAnnotator.h53 FormatToken *Current = First; in AnnotatedLine()
71 FormatToken *Current = First; in ~AnnotatedLine()
121 FormatToken *First;
122 FormatToken *Last;
174 bool spaceRequiredBeforeParens(const FormatToken &Right) const;
177 const FormatToken &Right) const;
180 const FormatToken &Right) const;
183 const FormatToken &Right) const;
186 const FormatToken &Right) const;
196 FormatToken *calculateInitializerColumnList(AnnotatedLine &Line,
[all …]
H A DFormatTokenLexer.h43 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
46 ArrayRef<FormatToken *> lex();
66 bool precedesOperand(FormatToken *Tok);
68 bool canPrecedeRegexLiteral(FormatToken *Prev);
97 FormatToken *getStashedToken();
99 FormatToken *getNextToken();
101 FormatToken *FormatTok;
114 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
117 SmallVector<FormatToken *, 16> Tokens;
132 void readRawToken(FormatToken &Tok);
H A DNamespaceEndCommentsFixer.cpp29 const FormatToken *
48 const FormatToken *skipAttribute(const FormatToken *Tok) { in skipAttribute()
87 const FormatToken *FirstNSTok = nullptr; in computeName()
160 bool hasEndComment(const FormatToken *RBraceTok) { in hasEndComment()
167 const FormatToken *Comment = RBraceTok->Next; in validEndComment()
236 const FormatToken *Comment = RBraceTok->Next; in updateEndComment()
247 const FormatToken *
291 FormatToken *Tok = Line->First; in analyze()
309 const FormatToken *NamespaceTok = in analyze()
313 FormatToken *RBraceTok = EndLine->First; in analyze()
[all …]
H A DMacroExpander.cpp36 SmallVector<FormatToken *, 8> Params;
37 SmallVector<FormatToken *, 8> Body;
116 FormatToken *Current = nullptr;
118 ArrayRef<FormatToken *> Tokens;
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()
187 for (FormatToken *Arg : Args[I->getValue()]) { in expand()
201 for (FormatToken *Tok : Def.Body) { in expand()
[all …]
H A DQualifierAlignmentFixer.cpp130 FormatToken *Next = First->Next; in insertQualifierAfter()
220 [&](const FormatToken *Tok, in analyzeRight()
221 const FormatToken *StartTemplate) -> const FormatToken * { in analyzeRight()
242 FormatToken *Qual = Tok->Next; in analyzeRight()
243 FormatToken *LastQual = Qual; in analyzeRight()
253 FormatToken *Closer = Tok->Next->Next; in analyzeRight()
274 FormatToken *Next = Tok->Next; in analyzeRight()
316 const FormatToken *Qual = Tok; in analyzeLeft()
317 const FormatToken *LastQual = Qual; in analyzeLeft()
361 const FormatToken *Next = Tok->Next; in analyzeLeft()
[all …]
H A DMacroCallReconstructor.cpp33 FormatToken *Parent = nullptr) { in forEachToken()
56 forEachToken(Line, [&](FormatToken *Token, FormatToken *Parent, bool First) { in addLine()
74 void MacroCallReconstructor::add(FormatToken *Token, in add()
139 FormatToken *Parent = getParentInResult(ExpandedParent); in prepareParent()
143 FormatToken *OpenMacroParent = nullptr; in prepareParent()
193 FormatToken *MacroCallReconstructor::getParentInResult(FormatToken *Parent) { in getParentInResult()
277 ArrayRef<FormatToken *> StartedMacros = in startReconstruction()
282 for (FormatToken *ID : llvm::reverse(StartedMacros)) { in startReconstruction()
329 FormatToken *Token = T->Tok; in endReconstruction()
370 llvm::DenseSet<FormatToken *> Values; in debugParentMap()
[all …]
H A DUnwrappedLineParser.cpp173 FormatToken FakeEOF;
176 FormatToken *&ResetToken;
180 FormatToken *Token;
181 FormatToken *PreviousToken;
563 FormatToken *Next; in parseLevel()
616 FormatToken *Tok = FormatTok; in calculateBraceTypes()
625 FormatToken *NextTok; in calculateBraceTypes()
845 FormatToken *Tok = FormatTok; in parseBlock()
1340 static bool isC78ParameterDecl(const FormatToken *Tok, const FormatToken *Next, in isC78ParameterDecl()
2502 FormatToken *Tok = nullptr; in parseUnbracedBody()
[all …]
H A DContinuationIndenter.h32 struct FormatToken;
111 unsigned reformatRawStringLiteral(const FormatToken &Current,
118 unsigned handleEndOfLine(const FormatToken &Current, LineState &State,
123 llvm::Optional<FormatStyle> getRawStringStyle(const FormatToken &Current,
144 std::pair<unsigned, bool> breakProtrudingToken(const FormatToken &Current,
152 createBreakableToken(const FormatToken &Current, LineState &State,
182 unsigned addMultilineToken(const FormatToken &Current, LineState &State);
202 ParenState(const FormatToken *Tok, unsigned Indent, unsigned LastSpace, in ParenState()
221 const FormatToken *Tok;
420 FormatToken *NextToken;
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 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 DFormatToken.cpp39 bool FormatToken::isSimpleTypeSpecifier() const { in isSimpleTypeSpecifier()
73 bool FormatToken::isTypeOrIdentifier() const { in isTypeOrIdentifier()
77 bool FormatToken::opensBlockOrBlockTypeList(const FormatStyle &Style) const { in opensBlockOrBlockTypeList()
93 void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} in precomputeFormattingInfos()
105 const FormatToken *LBrace = in formatAfterToken()
167 static unsigned CodePointsBetween(const FormatToken *Begin, in CodePointsBetween()
168 const FormatToken *End) { in CodePointsBetween()
173 void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { in precomputeFormattingInfos()
198 FormatToken *ItemBegin = Token->Next; in precomputeFormattingInfos()
222 const FormatToken *ItemEnd = nullptr; in precomputeFormattingInfos()
[all …]
H A DTokenAnnotator.cpp872 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount()
915 FormatToken *Tok = CurrentToken; in consumeToken()
1709 static FormatToken *untilMatchingParen(FormatToken *Current) { in untilMatchingParen()
2084 auto MayBeArrayDelete = [](FormatToken *Tok) -> FormatToken * { in rParenEndsCast()
2403 FormatToken *CurrentToken;
2451 FormatToken *Start = Current; in parse()
2611 FormatToken *Start = Current; in parseConditionalExpr()
2637 FormatToken *Current;
2713 auto skipOperatorName = [](const FormatToken *Next) -> const FormatToken * { in isFunctionDeclarationName()
2979 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths()
[all …]
H A DAffectedRangeManager.h22 struct FormatToken;
42 bool affectsTokenRange(const FormatToken &First, const FormatToken &Last,
47 bool affectsLeadingEmptyLines(const FormatToken &Tok);
H A DFormatToken.h173 struct FormatToken;
227 struct FormatToken { struct
228 FormatToken() in FormatToken() argument
463 FormatToken *NextOperator = nullptr; argument
469 FormatToken *Previous = nullptr; argument
472 FormatToken *Next = nullptr; argument
706 FormatToken *Tok = Previous; in getPreviousNonComment()
714 const FormatToken *Tok = Next; in getNextNonComment()
729 const FormatToken *T = this; in isCppStructuredBinding() argument
763 FormatToken(const FormatToken &) = delete;
[all …]
H A DContinuationIndenter.cpp81 FormatToken *End = Tok.MatchingParen; in getLengthToMatchingParen()
124 const FormatToken &Previous = *Current.Previous; in startsNextParameter()
280 const FormatToken &Current = *State.NextToken; in canBreak()
338 const FormatToken &Current = *State.NextToken; in mustBreak()
594 const FormatToken &Current = *State.NextToken; in addTokenToState()
632 FormatToken &Current = *State.NextToken; in addTokenOnCurrentLine()
642 const FormatToken *Tok = &Previous; in addTokenOnCurrentLine()
837 FormatToken &Current = *State.NextToken; in addTokenOnNewLine()
1068 FormatToken &Current = *State.NextToken; in getNewLineColumn()
1684 for (const FormatToken *Tok = &Current; in moveStatePastScopeOpener()
[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.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 DUnwrappedLineFormatter.cpp29 bool isRecordLBrace(const FormatToken &Tok) { in isRecordLBrace()
104 int getIndentOffset(const FormatToken &RootToken) { in getIndentOffset()
173 const FormatToken *getMatchingNamespaceToken( in getMatchingNamespaceToken()
193 const FormatToken *NamespaceToken = in getMatchingNamespaceTokenText()
274 const FormatToken *Tok = PreviousLine->First; in tryFitMultipleLinesInOne()
482 const FormatToken *PreviousPrevious = in tryFitMultipleLinesInOne()
543 const FormatToken *First = TheLine->First; in tryFitMultipleLinesInOne()
764 FormatToken *Tok = I[1]->First; in tryMergeSimpleBlock()
897 static void markFinalized(FormatToken *Tok) { in markFinalized()
1397 FormatToken &RootToken = *Line.First; in formatFirstToken()
[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()
/llvm-project-15.0.7/clang/unittests/Format/
H A DTestLexer.h31 typedef llvm::SmallVector<FormatToken *, 8> TokenList;
33 inline std::ostream &operator<<(std::ostream &Stream, const FormatToken &Tok) {
51 inline std::string text(llvm::ArrayRef<FormatToken *> Tokens) { in text()
53 [](const std::string &R, FormatToken *Tok) { in text()
60 TestLexer(llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
68 ArrayRef<FormatToken *> Result = Lex.lex(); in lex()
87 FormatToken *id(llvm::StringRef Code) { in id()
109 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;

12