|
clang 24.0.0git
|
Namespaces | |
| namespace | encoding |
| namespace | internal |
Classes | |
| class | AffectedRangeManager |
| class | AnnotatedLine |
| class | BreakableBlockComment |
| class | BreakableComment |
| class | BreakableLineCommentSection |
| class | BreakableStringLiteral |
| class | BreakableStringLiteralUsingOperators |
| class | BreakableToken |
| Base class for tokens / ranges of tokens that can allow breaking within the tokens - for example, to avoid whitespace beyond the column limit, or to reflow text. More... | |
| class | CompoundStatementIndenter |
| class | ContinuationIndenter |
| class | DefinitionBlockSeparator |
| class | Environment |
| class | FatalDiagnosticConsumer |
| struct | FormatStyle |
| The FormatStyle is used to configure the formatting to follow specific guidelines. More... | |
| struct | FormattingAttemptStatus |
| Represents the status of a formatting attempt. More... | |
| struct | FormatToken |
A wrapper around a Token storing information about the whitespace characters preceding it. More... | |
| class | FormatTokenLexer |
| class | FormatTokenSource |
| struct | IndentationAndAlignment |
| Represents the spaces at the start of a line, keeping track of what the spaces are for. More... | |
| class | IndexedTokenSource |
| class | IntegerLiteralSeparatorFixer |
| class | JavaScriptImportSorter |
| struct | JsImportedSymbol |
| struct | JsModuleReference |
| class | LeftRightQualifierAlignmentFixer |
| struct | LineState |
| The current state when indenting a unwrapped line. More... | |
| class | MacroCallReconstructor |
| Converts a sequence of UnwrappedLines containing expanded macros into a single UnwrappedLine containing the macro calls. More... | |
| class | MacroExpander |
| Takes a set of macro definitions as strings and allows expanding calls to those macros. More... | |
| struct | MacroExpansion |
| Contains information on the token's role in a macro expansion. More... | |
| class | NamespaceEndCommentsFixer |
| class | NumericLiteralCaseFixer |
| struct | NumericLiteralInfo |
| class | ObjCPropertyAttributeOrderFixer |
| struct | ObjCPropertyEntry |
| struct | ParenState |
| class | ParseErrorCategory |
| struct | RawStringFormatStyleManager |
| class | ScopedLineState |
| class | ScopedMacroState |
| class | TokenAnalyzer |
| class | TokenAnnotator |
Determines extra information about the tokens comprising an UnwrappedLine. More... | |
| struct | UnwrappedLine |
An unwrapped line is a sequence of Token, that we would like to put on a single line if there was no column limit. More... | |
| class | UnwrappedLineConsumer |
| Interface for users of the UnwrappedLineParser to receive the parsed lines. More... | |
| class | UnwrappedLineFormatter |
| struct | UnwrappedLineNode |
| class | UnwrappedLineParser |
| class | UsingDeclarationsSorter |
| class | WhitespaceManager |
| Manages the whitespaces around tokens and their replacements. More... | |
Typedefs | |
| typedef std::function< std::pair< tooling::Replacements, unsigned >(const Environment &)> | AnalyzerPass |
Functions | |
| const std::error_category & | getParseCategory () |
| std::error_code | make_error_code (ParseError e) |
| FormatStyle | getLLVMStyle (FormatStyle::LanguageKind Language=FormatStyle::LK_Cpp) |
| Returns a format style complying with the LLVM coding standards: http://llvm.org/docs/CodingStandards.html. | |
| FormatStyle | getGoogleStyle (FormatStyle::LanguageKind Language) |
| Returns a format style complying with one of Google's style guides: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml. | |
| FormatStyle | getChromiumStyle (FormatStyle::LanguageKind Language) |
| Returns a format style complying with Chromium's style guide: http://www.chromium.org/developers/coding-style. | |
| FormatStyle | getMozillaStyle () |
| Returns a format style complying with Mozilla's style guide: https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html. | |
| FormatStyle | getWebKitStyle () |
| Returns a format style complying with Webkit's style guide: http://www.webkit.org/coding/coding-style.html. | |
| FormatStyle | getGNUStyle () |
| Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standards.html. | |
| FormatStyle | getMicrosoftStyle (FormatStyle::LanguageKind Language) |
| Returns a format style complying with Microsoft style guide: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017. | |
| FormatStyle | getClangFormatStyle () |
| FormatStyle | getNoStyle () |
| Returns style indicating formatting should be not applied at all. | |
| bool | getPredefinedStyle (StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style) |
| Gets a predefined style for the specified language by name. | |
| std::error_code | parseConfiguration (llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions=false, llvm::SourceMgr::DiagHandlerTy DiagHandler=nullptr, void *DiagHandlerCtx=nullptr, bool IsDotHFile=false) |
| Parse configuration from YAML-formatted text. | |
| std::error_code | parseConfiguration (StringRef Config, FormatStyle *Style, bool AllowUnknownOptions=false, bool IsDotHFile=false) |
| Like above but accepts an unnamed buffer. | |
| std::string | configurationAsText (const FormatStyle &Style) |
| Gets configuration in a YAML string. | |
| tooling::Replacements | sortIncludes (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, unsigned *Cursor=nullptr) |
| Returns the replacements necessary to sort all #include blocks that are affected by Ranges. | |
| Expected< tooling::Replacements > | formatReplacements (StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
Returns the replacements corresponding to applying and formatting Replaces on success; otheriwse, return an llvm::Error carrying llvm::StringError. | |
| Expected< tooling::Replacements > | cleanupAroundReplacements (StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
Returns the replacements corresponding to applying Replaces and cleaning up the code after that on success; otherwise, return an llvm::Error carrying llvm::StringError. | |
| tooling::Replacements | reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>", FormattingAttemptStatus *Status=nullptr) |
Reformats the given Ranges in Code. | |
| tooling::Replacements | reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, bool *IncompleteFormat) |
| Same as above, except if IncompleteFormat is non-null, its value will be set to true if any of the affected ranges were not formatted due to a non-recoverable syntax error. | |
| tooling::Replacements | cleanup (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Clean up any erroneous/redundant code in the given Ranges in Code. | |
| tooling::Replacements | fixNamespaceEndComments (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Fix namespace end comments in the given Ranges in Code. | |
| tooling::Replacements | separateDefinitionBlocks (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Inserts or removes empty lines separating definition blocks including classes, structs, functions, namespaces, and enums in the given Ranges in Code. | |
| tooling::Replacements | sortUsingDeclarations (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Sort consecutive using declarations in the given Ranges in Code. | |
| LangOptions | getFormattingLangOpts (const FormatStyle &Style=getLLVMStyle()) |
| Returns the LangOpts that the formatter expects you to set. | |
| Expected< FormatStyle > | getStyle (StringRef StyleName, StringRef FileName, StringRef FallbackStyle, StringRef Code="", llvm::vfs::FileSystem *FS=nullptr, bool AllowUnknownOptions=false, llvm::SourceMgr::DiagHandlerTy DiagHandler=nullptr) |
| Construct a FormatStyle based on StyleName. | |
| FormatStyle::LanguageKind | guessLanguage (StringRef FileName, StringRef Code) |
| StringRef | getLanguageName (FormatStyle::LanguageKind Language) |
| bool | isClangFormatOn (StringRef Comment) |
| bool | isClangFormatOff (StringRef Comment) |
| static constexpr StringRef | Blanks (" \t\v\f\r") |
| static StringRef | getLineCommentIndentPrefix (StringRef Comment, const FormatStyle &Style) |
| static BreakableToken::Split | getCommentSplit (StringRef Text, unsigned ContentStartColumn, unsigned ColumnLimit, unsigned TabWidth, encoding::Encoding Encoding, const FormatStyle &Style, bool DecorationEndsWithStar=false) |
| static BreakableToken::Split | getStringSplit (StringRef Text, unsigned UsedColumns, unsigned ColumnLimit, unsigned TabWidth, encoding::Encoding Encoding) |
| bool | switchesFormatting (const FormatToken &Token) |
Checks if Token switches formatting, like /* clang-format off */. | |
| static bool | mayReflowContent (StringRef Content) |
| static bool | shouldIndentWrappedSelectorName (const FormatStyle &Style, LineType LineType) |
| static bool | shouldUnindentNextOperator (const FormatToken &Tok) |
| static unsigned | getLengthToMatchingParen (const FormatToken &Tok, ArrayRef< ParenState > Stack) |
| static unsigned | getLengthToNextOperator (const FormatToken &Tok) |
| static bool | startsSegmentOfBuilderTypeCall (const FormatToken &Tok) |
| static bool | isAlignableBinaryOperator (const FormatToken &Token) |
| static bool | startsNextOperand (const FormatToken &Current) |
| static unsigned | getChainLength (const FormatToken &Op) |
| static bool | mustBreakBinaryOperation (const FormatToken &Current, const FormatStyle &Style) |
| static bool | opensProtoMessageField (const FormatToken &LessTok, const FormatStyle &Style) |
| static std::optional< StringRef > | getRawStringDelimiter (StringRef TokenText) |
| static StringRef | getCanonicalRawStringDelimiter (const FormatStyle &Style, FormatStyle::LanguageKind Language) |
| static bool | hasNestedBlockInlined (const FormatToken *Previous, const FormatToken &Current, const FormatStyle &Style) |
| static unsigned | getLastLineEndColumn (StringRef Text, unsigned StartColumn, unsigned TabWidth, encoding::Encoding Encoding) |
| static StringRef | getEnclosingFunctionName (const FormatToken &Current) |
| llvm::Error | make_string_error (const Twine &Message) |
| static void | expandPresetsBraceWrapping (FormatStyle &Expanded) |
| static void | expandPresetsSpaceBeforeParens (FormatStyle &Expanded) |
| static void | expandPresetsSpacesInParens (FormatStyle &Expanded) |
| ParseError | validateQualifierOrder (FormatStyle *Style) |
| static bool | affectsRange (ArrayRef< tooling::Range > Ranges, unsigned Start, unsigned End) |
| static std::pair< unsigned, unsigned > | FindCursorIndex (const ArrayRef< IncludeDirective > &Includes, const ArrayRef< unsigned > &Indices, unsigned Cursor) |
| std::string | replaceCRLF (const std::string &Code) |
| static void | sortCppIncludes (const FormatStyle &Style, const ArrayRef< IncludeDirective > &Includes, ArrayRef< tooling::Range > Ranges, StringRef FileName, StringRef Code, tooling::Replacements &Replaces, unsigned *Cursor) |
| tooling::Replacements | sortCppIncludes (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, tooling::Replacements &Replaces, unsigned *Cursor) |
| static unsigned | findJavaImportGroup (const FormatStyle &Style, StringRef ImportIdentifier) |
| static void | sortJavaImports (const FormatStyle &Style, const ArrayRef< JavaImportDirective > &Imports, ArrayRef< tooling::Range > Ranges, StringRef FileName, StringRef Code, tooling::Replacements &Replaces) |
| tooling::Replacements | sortJavaImports (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, tooling::Replacements &Replaces) |
| bool | isMpegTS (StringRef Code) |
| bool | isLikelyXml (StringRef Code) |
| template<typename T> | |
| static Expected< tooling::Replacements > | processReplacements (T ProcessFunc, StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
| static FormatStyle::LanguageKind | getLanguageByFileName (StringRef &FileName) |
| static FormatStyle::LanguageKind | getLanguageByComment (const Environment &Env) |
| llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > | loadAndParseConfigFile (StringRef ConfigFile, llvm::vfs::FileSystem *FS, FormatStyle *Style, bool AllowUnknownOptions, llvm::SourceMgr::DiagHandlerTy DiagHandler, bool IsDotHFile) |
| static bool | isClangFormatOnOff (StringRef Comment, bool On) |
| const char * | getTokenTypeName (TokenType Type) |
| Determines the name of a token type. | |
| static unsigned | CodePointsBetween (const FormatToken *Begin, const FormatToken *End) |
| bool | startsNextParameter (const FormatToken &Current, const FormatStyle &Style) |
| struct clang::format::FormatToken | getPrevious (T A1) const |
| template<typename... Ts> | |
| FormatToken * | getPreviousOneOf (Ts... Ks) const |
| FormatToken * | getPreviousNonComment () const |
| Returns the previous token ignoring comments. | |
| FormatToken * | getNextNonComment () const |
| Returns the next token ignoring comments. | |
| bool | isPossibleMacro (bool AllowFollowingColonColon=false) const |
Returns true if this token likely names an object-like macro. | |
| bool | isBlockIndentedInitRBrace (const FormatStyle &Style) const |
Returns true if this token ends a block indented initializer list. | |
| bool | opensBlockOrBlockTypeList (const FormatStyle &Style) const |
Returns true if this tokens starts a block-type list, i.e. a list that should be indented with a block indent. | |
| bool | isCppStructuredBinding (bool IsCpp) const |
| Returns whether the token is the left square bracket of a C++ structured binding declaration. | |
| bool | closesBlockOrBlockTypeList (const FormatStyle &Style) const |
| Same as opensBlockOrBlockTypeList, but for the closing token. | |
| const FormatToken * | getNamespaceToken () const |
| Return the actual namespace token, if this token starts a namespace block. | |
| void | copyFrom (const FormatToken &Tok) |
| static auto | lexCSharpString (const char *Begin, const char *End, bool Verbatim, bool Interpolated) |
| static size_t | countLeadingWhitespace (StringRef Text) |
| Count the length of leading whitespace in a token. | |
| static Base | getBase (StringRef IntegerLiteral) |
| template<typename T> | |
| void | forEachToken (const UnwrappedLine &Line, const T &Call, FormatToken *Parent=nullptr) |
| bool | matchFilePath (StringRef Pattern, StringRef FilePath) |
| bool | matchFilePath (llvm::StringRef Pattern, llvm::StringRef FilePath) |
| const FormatToken * | getNamespaceToken (const AnnotatedLine *Line, const SmallVectorImpl< AnnotatedLine * > &AnnotatedLines) |
| StringRef | getNamespaceTokenText (const AnnotatedLine *Line, const SmallVectorImpl< AnnotatedLine * > &AnnotatedLines) |
| static bool | isNumericLiteralCaseFixerNeeded (const FormatStyle &Style) |
| static std::string | transformComponent (StringRef Component, FormatStyle::NumericLiteralComponentStyle ConfigValue) |
| static bool | matchesReservedSuffix (StringRef Suffix) |
| Test if Suffix matches a C++ literal reserved by the library. | |
| static std::string | format (StringRef NumericLiteral, const FormatStyle &Style) |
| void | addQualifierAlignmentFixerPasses (const FormatStyle &Style, SmallVectorImpl< AnalyzerPass > &Passes) |
| static void | replaceToken (const SourceManager &SourceMgr, tooling::Replacements &Fixes, const CharSourceRange &Range, std::string NewText) |
| static void | removeToken (const SourceManager &SourceMgr, tooling::Replacements &Fixes, const FormatToken *First) |
| static void | insertQualifierAfter (const SourceManager &SourceMgr, tooling::Replacements &Fixes, const FormatToken *First, const std::string &Qualifier) |
| static void | insertQualifierBefore (const SourceManager &SourceMgr, tooling::Replacements &Fixes, const FormatToken *First, const std::string &Qualifier) |
| static bool | endsWithSpace (const std::string &s) |
| static bool | startsWithSpace (const std::string &s) |
| static void | rotateTokens (const SourceManager &SourceMgr, tooling::Replacements &Fixes, const FormatToken *First, const FormatToken *Last, bool Left) |
| static bool | isConfiguredQualifier (const FormatToken *const Tok, const std::vector< tok::TokenKind > &Qualifiers) |
| static bool | isQualifier (const FormatToken *const Tok) |
| void | prepareLeftRightOrderingForQualifierAlignmentFixer (const std::vector< std::string > &Order, std::vector< std::string > &LeftOrder, std::vector< std::string > &RightOrder, std::vector< tok::TokenKind > &Qualifiers) |
| bool | isQualifierOrType (const FormatToken *Tok, const LangOptions &LangOpts) |
| bool | isConfiguredQualifierOrType (const FormatToken *Tok, const std::vector< tok::TokenKind > &Qualifiers, const LangOptions &LangOpts) |
| bool | operator< (const JsModuleReference &LHS, const JsModuleReference &RHS) |
| tooling::Replacements | sortJavaScriptImports (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName) |
| static bool | mustBreakAfterAttributes (const FormatToken &Tok, const FormatStyle &Style) |
| static unsigned | maxNestingDepth (const AnnotatedLine &Line) |
| static FormatToken * | skipNameQualifier (const FormatToken *Tok) |
| static FormatToken * | getFunctionName (const AnnotatedLine &Line, FormatToken *&OpeningParen) |
| static bool | isCtorOrDtorName (const FormatToken *Tok) |
| static bool | isFunctionDeclarationName (const LangOptions &LangOpts, const FormatToken &Current, const AnnotatedLine &Line, FormatToken *&ClosingParen) |
| static FormatToken * | findReturnTypeStart (const AnnotatedLine &Line) |
| static bool | isAllmanBrace (const FormatToken &Tok) |
| static bool | IsFunctionArgument (const FormatToken &Tok) |
| static bool | isEmptyLambdaAllowed (const FormatToken &Tok, FormatStyle::ShortLambdaStyle ShortLambdaOption) |
| static bool | isAllmanLambdaBrace (const FormatToken &Tok) |
| static auto | computeNewlines (const AnnotatedLine &Line, const AnnotatedLine *PreviousLine, const AnnotatedLine *PrevPrevLine, const SmallVectorImpl< AnnotatedLine * > &Lines, const FormatStyle &Style) |
| std::ostream & | operator<< (std::ostream &Stream, const UnwrappedLine &Line) |
| template<class T> | |
| static void | hash_combine (std::size_t &seed, const T &v) |
| static bool | isGoogScope (const UnwrappedLine &Line) |
| static bool | isIIFE (const UnwrappedLine &Line, const AdditionalKeywords &Keywords) |
| static bool | ShouldBreakBeforeBrace (const FormatStyle &Style, const FormatToken &InitialToken, bool IsEmptyBlock, bool IsJavaRecord=false) |
| static bool | tokenCanStartNewLine (const FormatToken &Tok) |
| static bool | mustBeJSIdent (const AdditionalKeywords &Keywords, const FormatToken *FormatTok) |
| static bool | mustBeJSIdentOrValue (const AdditionalKeywords &Keywords, const FormatToken *FormatTok) |
| static bool | isJSDeclOrStmt (const AdditionalKeywords &Keywords, const FormatToken *FormatTok) |
| static bool | isC78Type (const FormatToken &Tok) |
| static bool | isC78ParameterDecl (const FormatToken *Tok, const FormatToken *Next, const FormatToken *FuncName) |
| static FormatToken * | getLastNonComment (const UnwrappedLine &Line) |
| static void | markOptionalBraces (FormatToken *LeftBrace) |
| static bool | continuesLineCommentSection (const FormatToken &FormatTok, const UnwrappedLine &Line, const FormatStyle &Style, const llvm::Regex &CommentPragmasRegex) |
| static const FormatToken & | getLineStart (const FormatToken &Tok) |
| static unsigned | indentLevelFor (const WhitespaceManager::Change &C) |
| static void | SetChangeSpaces (unsigned Start, unsigned Spaces, MutableArrayRef< WhitespaceManager::Change > Changes) |
| static void | IncrementChangeSpaces (unsigned Start, int Delta, MutableArrayRef< WhitespaceManager::Change > Changes) |
| static void | AlignTokenSequence (const FormatStyle &Style, unsigned Start, unsigned End, unsigned Column, bool RightJustify, ArrayRef< unsigned > Matches, SmallVector< WhitespaceManager::Change, 16 > &Changes) |
| template<typename F, AlignStrategy Strategy = AlignStrategy::Normal> | |
| static unsigned | AlignTokens (const FormatStyle &Style, F &&Matches, SmallVector< WhitespaceManager::Change, 16 > &Changes, unsigned StartAt, const FormatStyle::AlignConsecutiveStyle &ACS={}, bool RightJustify=false) |
Variables | |
| const char * | StyleOptionHelpDescription |
| Description to be used for help text for a llvm::cl option for specifying format style. | |
| const char * | DefaultFormatStyle = "file" |
| The suggested format style to use by default. | |
| const char * | DefaultFallbackStyle = "LLVM" |
| The suggested predefined style to use as the fallback style in getStyle. | |
| static constexpr std::array< StringRef, 16 > | QtPropertyKeywords |
| static constexpr std::array< StringRef, 14 > | CppNonKeywordTypes |
| typedef std::function<std::pair<tooling::Replacements, unsigned>( const Environment &)> clang::format::AnalyzerPass |
Definition at line 25 of file QualifierAlignmentFixer.h.
|
strong |
| Enumerator | |
|---|---|
| Binary | |
| Decimal | |
| Hex | |
| Other | |
Definition at line 20 of file IntegerLiteralSeparatorFixer.cpp.
| Enumerator | |
|---|---|
| BK_Unknown | |
| BK_Block | |
| BK_BracedInit | |
Definition at line 238 of file FormatToken.h.
| Enumerator | |
|---|---|
| FD_Unformatted | |
| FD_Continue | |
| FD_Break | |
Definition at line 243 of file FormatToken.h.
| Enumerator | |
|---|---|
| NORMAL | |
| TEMPLATE_STRING | |
| TOKEN_STASHED | |
Definition at line 29 of file FormatTokenLexer.h.
Definition at line 23 of file TokenAnnotator.h.
Roles a token can take in a configured macro expansion.
Definition at line 246 of file FormatToken.h.
| Enumerator | |
|---|---|
| PPK_BinPacked | |
| PPK_OnePerLine | |
| PPK_Inconclusive | |
Definition at line 241 of file FormatToken.h.
|
strong |
| Enumerator | |
|---|---|
| ST_Class | |
| ST_Enum | |
| ST_CompoundRequirement | |
| ST_Other | |
Definition at line 40 of file TokenAnnotator.h.
| enum clang::format::TokenType : uint8_t |
Determines the semantic type of a syntactic token, e.g.
whether "<" is a template opener or binary operator.
| Enumerator | |
|---|---|
| NUM_TOKEN_TYPES | |
Definition at line 227 of file FormatToken.h.
| void clang::format::addQualifierAlignmentFixerPasses | ( | const FormatStyle & | Style, |
| SmallVectorImpl< AnalyzerPass > & | Passes ) |
Definition at line 25 of file QualifierAlignmentFixer.cpp.
References prepareLeftRightOrderingForQualifierAlignmentFixer(), and clang::format::TokenAnalyzer::process().
Referenced by clang::format::internal::reformat().
|
static |
Definition at line 3571 of file Format.cpp.
Referenced by sortCppIncludes(), and sortJavaImports().
|
static |
Definition at line 506 of file WhitespaceManager.cpp.
|
static |
Definition at line 346 of file WhitespaceManager.cpp.
References clang::Column, IncrementChangeSpaces(), NewlinesBefore, clang::format::FormatStyle::PAS_Right, Previous, clang::format::FormatStyle::RAS_Pointer, clang::format::FormatStyle::RAS_Right, and Tok.
|
staticconstexpr |
Referenced by clang::format::BreakableBlockComment::adaptStartOfLine(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), getCommentSplit(), clang::format::BreakableBlockComment::getContentIndent(), clang::format::BreakableBlockComment::getReflowSplit(), clang::format::BreakableLineCommentSection::getReflowSplit(), clang::format::BreakableBlockComment::getSplitAfterLastLine(), getStringSplit(), clang::format::BreakableBlockComment::introducesBreakBeforeToken(), clang::format::BreakableBlockComment::mayReflow(), mayReflowContent(), and clang::format::BreakableBlockComment::reflow().
| tooling::Replacements clang::format::cleanup | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName = "<stdin>" ) |
Clean up any erroneous/redundant code in the given Ranges in Code.
Returns the Replacements that clean up all Ranges in Code.
Definition at line 4468 of file Format.cpp.
References clang::FileName, clang::format::FormatStyle::LK_Cpp, and clang::format::Environment::make().
Referenced by cleanupAroundReplacements().
| Expected< tooling::Replacements > clang::format::cleanupAroundReplacements | ( | StringRef | Code, |
| const tooling::Replacements & | Replaces, | ||
| const FormatStyle & | Style ) |
Returns the replacements corresponding to applying Replaces and cleaning up the code after that on success; otherwise, return an llvm::Error carrying llvm::StringError.
This also supports inserting/deleting C++ #include directives:
Code.Code if it exists. The include manipulation is done via tooling::HeaderInclude, see its documentation for more details on how include insertion points are found and what edits are produced. Definition at line 4235 of file Format.cpp.
References cleanup(), clang::FileName, and processReplacements().
Referenced by clang::tooling::applyAtomicChanges().
| bool clang::format::closesBlockOrBlockTypeList | ( | const FormatStyle & | Style | ) | const |
Same as opensBlockOrBlockTypeList, but for the closing token.
Definition at line 941 of file FormatToken.h.
References clang::format::FormatToken::isNot().
|
static |
Definition at line 172 of file FormatToken.cpp.
References clang::format::FormatToken::ColumnWidth, and clang::format::FormatToken::TotalLength.
Referenced by clang::CommaSeparatedList::precomputeFormattingInfos().
|
static |
Definition at line 1630 of file UnwrappedLineFormatter.cpp.
References clang::format::FormatStyle::ELAAMS_Always, clang::format::FormatStyle::ELAAMS_Leave, clang::format::FormatStyle::ELAAMS_Never, clang::format::FormatStyle::ELBAMS_Always, clang::format::FormatStyle::ELBAMS_Leave, clang::format::FormatStyle::ELBAMS_LogicalBlock, clang::format::FormatStyle::ELBAMS_Never, clang::format::AnnotatedLine::endsWith(), clang::format::AnnotatedLine::First, getNamespaceToken(), clang::format::AnnotatedLine::InPPDirective, clang::format::FormatToken::is(), clang::format::FormatToken::isNot(), clang::format::FormatToken::isOneOf(), clang::format::AnnotatedLine::Last, clang::Line, Newlines, clang::format::AnnotatedLine::startsWith(), clang::format::AnnotatedLine::startsWithNamespace(), clang::format::FormatStyle::WNBWELS_Leave, and clang::format::FormatStyle::WNBWELS_Never.
| std::string clang::format::configurationAsText | ( | const FormatStyle & | Style | ) |
Gets configuration in a YAML string.
Definition at line 2588 of file Format.cpp.
References expandPresetsBraceWrapping(), expandPresetsSpaceBeforeParens(), expandPresetsSpacesInParens(), and clang::Text.
|
static |
Definition at line 4789 of file UnwrappedLineParser.cpp.
References clang::continuesLineComment(), continuesLineCommentSection(), clang::format::FormatToken::is(), clang::isLineComment(), clang::Line, clang::format::FormatToken::NewlinesBefore, clang::format::FormatStyle::RCS_Always, clang::format::UnwrappedLineNode::Tok, and clang::format::FormatToken::TokenText.
Referenced by continuesLineCommentSection().
| void clang::format::copyFrom | ( | const FormatToken & | Tok | ) |
Definition at line 962 of file FormatToken.h.
References clang::format::FormatToken::is(), and clang::format::FormatToken::isOneOf().
|
static |
Count the length of leading whitespace in a token.
Definition at line 1226 of file FormatTokenLexer.cpp.
References clang::isHorizontalWhitespace(), clang::isVerticalWhitespace(), clang::isWhitespace(), and clang::Text.
|
static |
Definition at line 100 of file QualifierAlignmentFixer.cpp.
Referenced by rotateTokens().
|
static |
Definition at line 1715 of file Format.cpp.
References clang::format::FormatStyle::BraceWrappingFlags::AfterCaseLabel, clang::format::FormatStyle::BraceWrappingFlags::AfterClass, clang::format::FormatStyle::BraceWrappingFlags::AfterControlStatement, clang::format::FormatStyle::BraceWrappingFlags::AfterEnum, clang::format::FormatStyle::BraceWrappingFlags::AfterExternBlock, clang::format::FormatStyle::BraceWrappingFlags::AfterFunction, clang::format::FormatStyle::BraceWrappingFlags::AfterNamespace, clang::format::FormatStyle::BraceWrappingFlags::AfterObjCDeclaration, clang::format::FormatStyle::BraceWrappingFlags::AfterStruct, clang::format::FormatStyle::BraceWrappingFlags::AfterUnion, clang::format::FormatStyle::BraceWrappingFlags::BeforeCatch, clang::format::FormatStyle::BraceWrappingFlags::BeforeElse, clang::format::FormatStyle::BraceWrappingFlags::BeforeLambdaBody, clang::format::FormatStyle::BraceWrapping, clang::format::FormatStyle::BreakBeforeBraces, clang::format::FormatStyle::BS_Allman, clang::format::FormatStyle::BS_Custom, clang::format::FormatStyle::BS_GNU, clang::format::FormatStyle::BS_Linux, clang::format::FormatStyle::BS_Mozilla, clang::format::FormatStyle::BS_Stroustrup, clang::format::FormatStyle::BS_WebKit, clang::format::FormatStyle::BS_Whitesmiths, clang::format::FormatStyle::BWACS_Always, clang::format::FormatStyle::BWACS_Never, clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyFunction, and clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyRecord.
Referenced by configurationAsText(), and clang::format::internal::reformat().
|
static |
Definition at line 1815 of file Format.cpp.
References clang::format::FormatStyle::SpaceBeforeParensCustom::AfterControlStatements, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterForeachMacros, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterIfMacros, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterPlacementOperator, clang::format::FormatStyle::SpaceBeforeParensCustom::BeforeNonEmptyParentheses, clang::format::FormatStyle::SBPO_ControlStatements, clang::format::FormatStyle::SBPO_ControlStatementsExceptControlMacros, clang::format::FormatStyle::SBPO_Custom, clang::format::FormatStyle::SBPO_NonEmptyParentheses, clang::format::FormatStyle::SpaceBeforeParens, and clang::format::FormatStyle::SpaceBeforeParensOptions.
Referenced by configurationAsText(), and clang::format::internal::reformat().
|
static |
Definition at line 1839 of file Format.cpp.
References clang::format::FormatStyle::SIPO_Custom, clang::format::FormatStyle::SIPO_Never, clang::format::FormatStyle::SpacesInParens, and clang::format::FormatStyle::SpacesInParensOptions.
Referenced by configurationAsText(), and clang::format::internal::reformat().
|
static |
Definition at line 3591 of file Format.cpp.
References clang::Text.
Referenced by sortCppIncludes().
|
static |
Definition at line 3899 of file Format.cpp.
Referenced by sortJavaImports().
|
static |
Definition at line 4102 of file TokenAnnotator.cpp.
References clang::isReturnTypePrefixSpecifier(), clang::Line, Next, and Tok.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation().
| tooling::Replacements clang::format::fixNamespaceEndComments | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName = "<stdin>" ) |
Fix namespace end comments in the given Ranges in Code.
Returns the Replacements that fix the namespace comments in all Ranges in Code.
Definition at line 4490 of file Format.cpp.
References clang::FileName, clang::format::Environment::make(), and clang::format::TokenAnalyzer::process().
| void clang::format::forEachToken | ( | const UnwrappedLine & | Line, |
| const T & | Call, | ||
| FormatToken * | Parent = nullptr ) |
Definition at line 32 of file MacroCallReconstructor.cpp.
References clang::Call, clang::First, forEachToken(), clang::Line, and clang::T.
Referenced by clang::format::MacroCallReconstructor::addLine(), and forEachToken().
|
static |
Definition at line 78 of file NumericLiteralCaseFixer.cpp.
References clang::format::NumericLiteralInfo::BaseLetterPos, clang::format::NumericLiteralInfo::ExponentLetterPos, format(), matchesReservedSuffix(), clang::format::NumericLiteralInfo::SuffixPos, and transformComponent().
Referenced by format(), and clang::format::NumericLiteralCaseFixer::process().
| Expected< tooling::Replacements > clang::format::formatReplacements | ( | StringRef | Code, |
| const tooling::Replacements & | Replaces, | ||
| const FormatStyle & | Style ) |
Returns the replacements corresponding to applying and formatting Replaces on success; otheriwse, return an llvm::Error carrying llvm::StringError.
Definition at line 4123 of file Format.cpp.
References clang::FileName, processReplacements(), reformat(), clang::format::FormatStyle::SortIncludes, and sortIncludes().
Referenced by clang::tooling::formatAndApplyAllReplacements().
|
static |
Definition at line 22 of file IntegerLiteralSeparatorFixer.cpp.
References Binary, Decimal, Hex, and Other.
Referenced by clang::format::IntegerLiteralSeparatorFixer::process().
|
static |
Definition at line 230 of file ContinuationIndenter.cpp.
|
static |
Definition at line 149 of file ContinuationIndenter.cpp.
References clang::Last.
Referenced by mustBreakBinaryOperation().
| FormatStyle clang::format::getChromiumStyle | ( | FormatStyle::LanguageKind | Language | ) |
Returns a format style complying with Chromium's style guide: http://www.chromium.org/developers/coding-style.
Definition at line 2249 of file Format.cpp.
References clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine, clang::format::FormatStyle::AllowShortFunctionsOnASingleLine, clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine, clang::format::FormatStyle::AllowShortLoopsOnASingleLine, clang::format::FormatStyle::PackParametersStyle::BinPack, clang::format::FormatStyle::BPPS_OnePerLine, clang::format::FormatStyle::BreakAfterJavaFieldAnnotations, clang::format::FormatStyle::ColumnLimit, clang::format::FormatStyle::ContinuationIndentWidth, clang::format::FormatStyle::DerivePointerAlignment, getGoogleStyle(), clang::tooling::IncludeStyle::IBS_Preserve, clang::tooling::IncludeStyle::IncludeBlocks, clang::format::FormatStyle::IncludeStyle, clang::format::FormatStyle::IndentWidth, clang::format::FormatStyle::JavaImportGroups, clang::format::FormatStyle::LK_Java, clang::format::FormatStyle::LK_JavaScript, clang::format::FormatStyle::LK_ObjC, clang::format::FormatStyle::PackParameters, clang::format::FormatStyle::ShortFunctionStyle::setEmptyAndInline(), clang::format::FormatStyle::SIS_Never, and clang::format::FormatStyle::SIS_WithoutElse.
Referenced by getPredefinedStyle().
| FormatStyle clang::format::getClangFormatStyle | ( | ) |
Definition at line 2404 of file Format.cpp.
References getLLVMStyle(), clang::format::FormatStyle::LE_LF, and clang::format::FormatStyle::RPS_ReturnStatement.
Referenced by getPredefinedStyle().
|
static |
Definition at line 56 of file BreakableToken.cpp.
References Blanks(), clang::format::encoding::columnWidthWithTabs(), clang::format::encoding::getCodePointNumBytes(), and clang::Text.
Referenced by clang::format::BreakableBlockComment::getSplit(), and clang::format::BreakableComment::getSplit().
|
static |
Definition at line 2584 of file ContinuationIndenter.cpp.
References Tok.
| LangOptions clang::format::getFormattingLangOpts | ( | const FormatStyle & | Style = getLLVMStyle() | ) |
Returns the LangOpts that the formatter expects you to set.
| Style | determines specific settings for lexing mode. |
Definition at line 4510 of file Format.cpp.
References clang::format::FormatStyle::LK_C, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_ObjC, clang::format::FormatStyle::LS_Auto, clang::format::FormatStyle::LS_Cpp11, clang::format::FormatStyle::LS_Cpp14, clang::format::FormatStyle::LS_Cpp17, clang::format::FormatStyle::LS_Cpp20, clang::format::FormatStyle::LS_Cpp23, clang::format::FormatStyle::LS_Cpp26, and clang::format::FormatStyle::LS_Latest.
Referenced by clang::format::IntegerLiteralSeparatorFixer::process(), clang::format::NumericLiteralCaseFixer::process(), clang::format::TokenAnalyzer::TokenAnalyzer(), clang::format::TokenAnnotator::TokenAnnotator(), and clang::format::UnwrappedLineParser::UnwrappedLineParser().
|
static |
Definition at line 3745 of file TokenAnnotator.cpp.
References clang::Line, Next, skipNameQualifier(), and Tok.
Referenced by clang::format::TokenAnnotator::annotate().
| FormatStyle clang::format::getGNUStyle | ( | ) |
Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standards.html.
Definition at line 2360 of file Format.cpp.
References clang::format::FormatStyle::BLS_Block, clang::format::FormatStyle::BOS_All, clang::format::FormatStyle::BS_GNU, clang::format::FormatStyle::DRTBS_All, getLLVMStyle(), clang::format::FormatStyle::RTBS_AllDefinitions, and clang::format::FormatStyle::SBPO_Always.
Referenced by getPredefinedStyle().
| FormatStyle clang::format::getGoogleStyle | ( | FormatStyle::LanguageKind | Language | ) |
Returns a format style complying with one of Google's style guides: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml. https://developers.google.com/protocol-buffers/docs/style.
Definition at line 2097 of file Format.cpp.
References clang::format::FormatStyle::AccessModifierOffset, clang::format::FormatStyle::AlignAfterOpenBracket, clang::format::FormatStyle::AlignEscapedNewlines, clang::format::FormatStyle::AlignOperands, clang::format::FormatStyle::AlignTrailingComments, clang::format::FormatStyle::AllowShortFunctionsOnASingleLine, clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine, clang::format::FormatStyle::AllowShortLambdasOnASingleLine, clang::format::FormatStyle::AllowShortLoopsOnASingleLine, clang::format::FormatStyle::AlwaysBreakBeforeMultilineStrings, clang::format::FormatStyle::KeepEmptyLinesStyle::AtStartOfBlock, clang::format::FormatStyle::AttributeMacros, clang::format::FormatStyle::BLS_Block, clang::format::FormatStyle::BOS_NonAssignment, clang::format::FormatStyle::BPS_Never, clang::format::FormatStyle::BreakAfterOpenBracketBracedList, clang::format::FormatStyle::BreakAfterOpenBracketFunction, clang::format::FormatStyle::BreakAfterOpenBracketIf, clang::format::FormatStyle::BreakBeforeBinaryOperators, clang::format::FormatStyle::BreakBeforeTernaryOperators, clang::format::FormatStyle::BreakStringLiterals, clang::format::FormatStyle::BreakTemplateDeclarations, clang::format::FormatStyle::BTDS_Yes, clang::format::FormatStyle::ColumnLimit, clang::format::FormatStyle::CommentPragmas, clang::format::FormatStyle::Cpp11BracedListStyle, clang::format::FormatStyle::DerivePointerAlignment, clang::format::FormatStyle::ENAS_Left, getGoogleStyle(), getLLVMStyle(), clang::tooling::IncludeStyle::IBS_Preserve, clang::tooling::IncludeStyle::IBS_Regroup, clang::tooling::IncludeStyle::IncludeBlocks, clang::tooling::IncludeStyle::IncludeCategories, clang::tooling::IncludeStyle::IncludeIsMainRegex, clang::format::FormatStyle::IncludeStyle, clang::format::FormatStyle::IndentCaseLabels, clang::format::FormatStyle::JavaScriptQuotes, clang::format::FormatStyle::JavaScriptWrapImports, clang::format::FormatStyle::JSQS_Single, clang::format::FormatStyle::KeepEmptyLines, clang::format::FormatStyle::TrailingCommentsAlignmentStyle::Kind, clang::format::FormatStyle::Language, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_CSharp, clang::format::FormatStyle::LK_Java, clang::format::FormatStyle::LK_JavaScript, clang::format::FormatStyle::LK_ObjC, clang::format::FormatStyle::LK_Proto, clang::format::FormatStyle::LK_TextProto, clang::format::FormatStyle::LS_Auto, clang::format::FormatStyle::MaxEmptyLinesToKeep, clang::format::FormatStyle::NamespaceIndentation, clang::format::FormatStyle::NI_All, clang::format::FormatStyle::OAS_DontAlign, clang::format::FormatStyle::ObjCBinPackProtocolList, clang::format::FormatStyle::ObjCSpaceAfterProperty, clang::format::FormatStyle::ObjCSpaceBeforeProtocolList, clang::format::FormatStyle::PackConstructorInitializers, clang::format::FormatStyle::PAS_Left, clang::format::FormatStyle::PCIS_NextLine, clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter, clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine, clang::format::FormatStyle::PointerAlignment, clang::format::FormatStyle::RawStringFormats, clang::format::FormatStyle::ShortFunctionStyle::setEmptyOnly(), clang::format::FormatStyle::SIS_Never, clang::format::FormatStyle::SIS_WithoutElse, clang::format::FormatStyle::SLS_Empty, clang::format::FormatStyle::SpaceAfterCStyleCast, clang::format::FormatStyle::SpacesBeforeTrailingComments, clang::format::FormatStyle::SpacesInContainerLiterals, clang::format::FormatStyle::Standard, and clang::format::FormatStyle::TCAS_Never.
Referenced by getChromiumStyle(), getGoogleStyle(), and getPredefinedStyle().
|
static |
Definition at line 4623 of file Format.cpp.
References clang::format::Environment::getFileID(), clang::format::Environment::getSourceManager(), clang::Lexer::LexFromRawLexer(), clang::format::FormatStyle::LK_C, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_None, clang::format::FormatStyle::LK_ObjC, clang::Lexer::SetCommentRetentionState(), clang::Text, and Tok.
Referenced by guessLanguage().
|
static |
Definition at line 4571 of file Format.cpp.
References clang::FileName, clang::format::FormatStyle::LK_C, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_CSharp, clang::format::FormatStyle::LK_Java, clang::format::FormatStyle::LK_JavaScript, clang::format::FormatStyle::LK_Json, clang::format::FormatStyle::LK_ObjC, clang::format::FormatStyle::LK_Proto, clang::format::FormatStyle::LK_TableGen, clang::format::FormatStyle::LK_TextProto, and clang::format::FormatStyle::LK_Verilog.
Referenced by guessLanguage().
|
inline |
Definition at line 6582 of file Format.h.
References clang::format::FormatStyle::LK_C, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_CSharp, clang::format::FormatStyle::LK_Java, clang::format::FormatStyle::LK_JavaScript, clang::format::FormatStyle::LK_Json, clang::format::FormatStyle::LK_ObjC, clang::format::FormatStyle::LK_Proto, clang::format::FormatStyle::LK_TableGen, clang::format::FormatStyle::LK_TextProto, and clang::format::FormatStyle::LK_Verilog.
Referenced by getStyle(), and clang::format::TokenAnalyzer::TokenAnalyzer().
|
static |
Definition at line 2352 of file ContinuationIndenter.cpp.
References clang::format::encoding::columnWidthWithTabs(), and clang::Text.
|
static |
Definition at line 2882 of file UnwrappedLineParser.cpp.
References getLastNonComment(), clang::Token::isNot(), and clang::Line.
Referenced by getLastNonComment().
|
static |
Definition at line 49 of file ContinuationIndenter.cpp.
References clang::format::FormatToken::CanBreakBefore, clang::format::FormatToken::isOneOf(), clang::format::FormatToken::MatchingParen, clang::format::FormatToken::Next, Tok, and clang::format::FormatToken::TotalLength.
Referenced by clang::format::ContinuationIndenter::mustBreak().
|
static |
Definition at line 119 of file ContinuationIndenter.cpp.
References Tok.
Referenced by clang::format::ContinuationIndenter::mustBreak().
|
static |
Definition at line 30 of file BreakableToken.cpp.
Referenced by clang::format::BreakableLineCommentSection::BreakableLineCommentSection().
|
static |
Definition at line 24 of file WhitespaceManager.cpp.
References FD_Break, clang::Result, and Tok.
Referenced by indentLevelFor().
| FormatStyle clang::format::getLLVMStyle | ( | FormatStyle::LanguageKind | Language = FormatStyle::LK_Cpp | ) |
Returns a format style complying with the LLVM coding standards: http://llvm.org/docs/CodingStandards.html.
Definition at line 1847 of file Format.cpp.
References clang::format::FormatStyle::ABS_Leave, clang::format::FormatStyle::AccessModifierOffset, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterControlStatements, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterForeachMacros, clang::format::FormatStyle::SpaceBeforeParensCustom::AfterIfMacros, clang::format::FormatStyle::AIAS_None, clang::format::FormatStyle::AlignAfterOpenBracket, clang::format::FormatStyle::AlignArrayOfStructures, clang::format::FormatStyle::AlignConsecutiveAssignments, clang::format::FormatStyle::AlignConsecutiveBitFields, clang::format::FormatStyle::AlignConsecutiveDeclarations, clang::format::FormatStyle::AlignConsecutiveMacros, clang::format::FormatStyle::AlignConsecutiveShortCaseStatements, clang::format::FormatStyle::AlignConsecutiveTableGenBreakingDAGArgColons, clang::format::FormatStyle::AlignConsecutiveTableGenCondOperatorColons, clang::format::FormatStyle::AlignConsecutiveTableGenDefinitionColons, clang::format::FormatStyle::AlignEscapedNewlines, clang::format::FormatStyle::AlignConsecutiveStyle::AlignFunctionDeclarations, clang::format::FormatStyle::AlignOperands, clang::format::FormatStyle::TrailingCommentsAlignmentStyle::AlignPPAndNotPP, clang::format::FormatStyle::AlignTrailingComments, clang::format::FormatStyle::AllowAllArgumentsOnNextLine, clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine, clang::format::FormatStyle::AllowBreakBeforeNoexceptSpecifier, clang::format::FormatStyle::AllowBreakBeforeQtProperty, clang::format::FormatStyle::AllowShortBlocksOnASingleLine, clang::format::FormatStyle::AllowShortCaseExpressionOnASingleLine, clang::format::FormatStyle::AllowShortCaseLabelsOnASingleLine, clang::format::FormatStyle::AllowShortCompoundRequirementOnASingleLine, clang::format::FormatStyle::AllowShortEnumsOnASingleLine, clang::format::FormatStyle::AllowShortFunctionsOnASingleLine, clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine, clang::format::FormatStyle::AllowShortLambdasOnASingleLine, clang::format::FormatStyle::AllowShortLoopsOnASingleLine, clang::format::FormatStyle::AllowShortNamespacesOnASingleLine, clang::format::FormatStyle::AllowShortRecordOnASingleLine, clang::format::FormatStyle::AlwaysBreakAfterDefinitionReturnType, clang::format::FormatStyle::AlwaysBreakBeforeMultilineStrings, clang::prec::Assignment, clang::format::FormatStyle::AttributeMacros, clang::format::FormatStyle::BBCDS_Always, clang::format::FormatStyle::BBIAS_OnlyMultiline, clang::format::FormatStyle::BBNSS_Never, clang::format::FormatStyle::BBO_Never, clang::format::FormatStyle::BBRTS_None, clang::format::FormatStyle::BCIS_BeforeColon, clang::format::FormatStyle::BFCS_Both, clang::format::FormatStyle::BILS_BeforeColon, clang::format::FormatStyle::BinPackLongBracedList, clang::format::FormatStyle::BitFieldColonSpacing, clang::format::FormatStyle::BLS_AlignFirstComment, clang::format::FormatStyle::BOS_None, clang::format::FormatStyle::BPAS_BinPack, clang::format::FormatStyle::BPPS_BinPack, clang::format::FormatStyle::BPS_Auto, clang::format::FormatStyle::BracedInitializerIndentWidth, clang::format::FormatStyle::BraceWrapping, clang::format::FormatStyle::BreakAdjacentStringLiterals, clang::format::FormatStyle::BreakAfterAttributes, clang::format::FormatStyle::BreakAfterJavaFieldAnnotations, clang::format::FormatStyle::BreakAfterOpenBracketBracedList, clang::format::FormatStyle::BreakAfterOpenBracketFunction, clang::format::FormatStyle::BreakAfterOpenBracketIf, clang::format::FormatStyle::BreakAfterOpenBracketLoop, clang::format::FormatStyle::BreakAfterOpenBracketSwitch, clang::format::FormatStyle::BreakAfterReturnType, clang::format::FormatStyle::BreakArrays, clang::format::FormatStyle::BreakBeforeBinaryOperators, clang::format::FormatStyle::BreakBeforeBraces, clang::format::FormatStyle::BreakBeforeCloseBracketBracedList, clang::format::FormatStyle::BreakBeforeCloseBracketFunction, clang::format::FormatStyle::BreakBeforeCloseBracketIf, clang::format::FormatStyle::BreakBeforeCloseBracketLoop, clang::format::FormatStyle::BreakBeforeCloseBracketSwitch, clang::format::FormatStyle::BreakBeforeConceptDeclarations, clang::format::FormatStyle::BreakBeforeInlineASMColon, clang::format::FormatStyle::BreakBeforeReturnType, clang::format::FormatStyle::BreakBeforeTemplateCloser, clang::format::FormatStyle::BreakBeforeTernaryOperators, clang::format::FormatStyle::BreakBinaryOperations, clang::format::FormatStyle::BreakConstructorInitializers, clang::format::FormatStyle::BreakFunctionDeclarationParameters, clang::format::FormatStyle::BreakFunctionDefinitionParameters, clang::format::FormatStyle::BreakInheritanceList, clang::format::FormatStyle::BreakStringLiterals, clang::format::FormatStyle::BreakTemplateDeclarations, clang::format::FormatStyle::BS_Attach, clang::format::FormatStyle::BTDS_MultiLine, clang::format::FormatStyle::BWACS_Never, clang::format::FormatStyle::ColumnLimit, clang::format::FormatStyle::CommentPragmas, clang::format::FormatStyle::CompactNamespaces, clang::format::FormatStyle::ConstructorInitializerIndentWidth, clang::format::FormatStyle::ContinuationIndentWidth, clang::format::FormatStyle::Cpp11BracedListStyle, clang::format::FormatStyle::DAS_DontBreak, clang::format::FormatStyle::DerivePointerAlignment, clang::format::FormatStyle::DisableFormat, clang::format::FormatStyle::DRTBS_None, clang::format::FormatStyle::ELAAMS_Never, clang::format::FormatStyle::ELBAMS_LogicalBlock, clang::format::FormatStyle::EmptyLineAfterAccessModifier, clang::format::FormatStyle::EmptyLineBeforeAccessModifier, clang::format::FormatStyle::ENAS_Right, clang::format::FormatStyle::EnumTrailingComma, clang::format::FormatStyle::ETC_Leave, clang::format::FormatStyle::ExperimentalAutoDetectBinPacking, clang::format::FormatStyle::FixNamespaceComments, clang::format::FormatStyle::ForEachMacros, clang::tooling::IncludeStyle::IBS_Preserve, clang::format::FormatStyle::IEBS_AfterExternBlock, clang::format::FormatStyle::IfMacros, clang::format::FormatStyle::IGLS_OuterIndent, clang::tooling::IncludeStyle::IncludeBlocks, clang::tooling::IncludeStyle::IncludeCategories, clang::tooling::IncludeStyle::IncludeIsMainRegex, clang::format::FormatStyle::IncludeStyle, clang::format::FormatStyle::IndentAccessModifiers, clang::format::FormatStyle::IndentCaseBlocks, clang::format::FormatStyle::IndentCaseLabels, clang::format::FormatStyle::IndentExportBlock, clang::format::FormatStyle::IndentExternBlock, clang::format::FormatStyle::IndentGotoLabels, clang::format::FormatStyle::IndentPPDirectives, clang::format::FormatStyle::IndentRequiresClause, clang::format::FormatStyle::IndentWidth, clang::format::FormatStyle::IndentWrappedFunctionNames, clang::format::FormatStyle::InsertBraces, clang::format::FormatStyle::InsertNewlineAtEOF, clang::format::FormatStyle::InsertTrailingCommas, clang::format::FormatStyle::IntegerLiteralSeparator, clang::format::FormatStyle::JavaScriptQuotes, clang::format::FormatStyle::JavaScriptWrapImports, clang::format::FormatStyle::JSQS_Leave, clang::format::FormatStyle::KeepEmptyLines, clang::format::FormatStyle::KeepFormFeed, clang::format::FormatStyle::TrailingCommentsAlignmentStyle::Kind, clang::format::FormatStyle::LambdaBodyIndentation, clang::format::FormatStyle::Language, clang::format::FormatStyle::LBI_Signature, clang::format::FormatStyle::LE_DeriveLF, clang::format::FormatStyle::LineEnding, clang::format::FormatStyle::LK_Json, clang::format::FormatStyle::LK_TableGen, clang::format::FormatStyle::LK_Verilog, clang::format::FormatStyle::LS_Latest, clang::tooling::IncludeStyle::MainIncludeChar, clang::format::FormatStyle::MaxEmptyLinesToKeep, clang::tooling::IncludeStyle::MICD_Quote, clang::format::FormatStyle::NamespaceIndentation, clang::format::FormatStyle::NI_None, clang::format::FormatStyle::NLCS_Leave, clang::format::FormatStyle::NumericLiteralCase, clang::format::FormatStyle::OAS_Align, clang::format::FormatStyle::ObjCBinPackProtocolList, clang::format::FormatStyle::ObjCBlockIndentWidth, clang::format::FormatStyle::ObjCBreakBeforeNestedBlockParam, clang::format::FormatStyle::ObjCSpaceAfterMethodDeclarationPrefix, clang::format::FormatStyle::ObjCSpaceAfterProperty, clang::format::FormatStyle::ObjCSpaceBeforeProtocolList, clang::format::FormatStyle::TrailingCommentsAlignmentStyle::OverEmptyLines, clang::format::FormatStyle::PackArguments, clang::format::FormatStyle::PackConstructorInitializers, clang::format::FormatStyle::PackParameters, clang::format::FormatStyle::AlignConsecutiveStyle::PadOperators, clang::format::FormatStyle::PAS_Right, clang::format::FormatStyle::PCIS_BinPack, clang::format::FormatStyle::PenaltyBreakAssignment, clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter, clang::format::FormatStyle::PenaltyBreakBeforeMemberAccess, clang::format::FormatStyle::PenaltyBreakComment, clang::format::FormatStyle::PenaltyBreakFirstLessLess, clang::format::FormatStyle::PenaltyBreakOpenParenthesis, clang::format::FormatStyle::PenaltyBreakScopeResolution, clang::format::FormatStyle::PenaltyBreakString, clang::format::FormatStyle::PenaltyBreakTemplateDeclaration, clang::format::FormatStyle::PenaltyExcessCharacter, clang::format::FormatStyle::PenaltyIndentedWhitespace, clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine, clang::format::FormatStyle::PointerAlignment, clang::format::FormatStyle::PPDIS_None, clang::format::FormatStyle::PPIndentWidth, clang::format::FormatStyle::QAS_Leave, clang::format::FormatStyle::QualifierAlignment, clang::format::FormatStyle::RAS_Pointer, clang::format::FormatStyle::RCPS_OwnLine, clang::format::FormatStyle::RCS_Always, clang::format::FormatStyle::ReferenceAlignment, clang::format::FormatStyle::ReflowComments, clang::format::FormatStyle::REI_OuterScope, clang::prec::Relational, clang::format::FormatStyle::RemoveBracesLLVM, clang::format::FormatStyle::RemoveEmptyLinesInUnwrappedLines, clang::format::FormatStyle::RemoveParentheses, clang::format::FormatStyle::RemoveSemicolon, clang::format::FormatStyle::RequiresClausePosition, clang::format::FormatStyle::RequiresExpressionIndentation, clang::format::FormatStyle::RPS_Leave, clang::format::FormatStyle::RTBS_None, clang::format::FormatStyle::SAPQ_Default, clang::format::FormatStyle::SBPO_ControlStatements, clang::format::FormatStyle::SBS_Never, clang::format::FormatStyle::SDS_Leave, clang::format::FormatStyle::SeparateDefinitionBlocks, clang::format::FormatStyle::ShortFunctionStyle::setAll(), clang::format::FormatStyle::ShortNamespaceLines, clang::format::FormatStyle::SIAS_Never, clang::format::FormatStyle::SIBCS_Leave, clang::format::FormatStyle::SIEB_Never, clang::format::FormatStyle::SIPO_Never, clang::format::FormatStyle::SIS_Never, clang::format::FormatStyle::SJSIO_Before, clang::format::FormatStyle::SkipMacroDefinitionBody, clang::format::FormatStyle::SLS_All, clang::format::FormatStyle::SortIncludes, clang::format::FormatStyle::SortJavaStaticImport, clang::format::FormatStyle::SortUsingDeclarations, clang::format::FormatStyle::SpaceAfterCStyleCast, clang::format::FormatStyle::SpaceAfterLogicalNot, clang::format::FormatStyle::SpaceAfterOperatorKeyword, clang::format::FormatStyle::SpaceAfterTemplateKeyword, clang::format::FormatStyle::SpaceAroundPointerQualifiers, clang::format::FormatStyle::SpaceBeforeAssignmentOperators, clang::format::FormatStyle::SpaceBeforeCaseColon, clang::format::FormatStyle::SpaceBeforeCpp11BracedList, clang::format::FormatStyle::SpaceBeforeCtorInitializerColon, clang::format::FormatStyle::SpaceBeforeEnumUnderlyingTypeColon, clang::format::FormatStyle::SpaceBeforeInheritanceColon, clang::format::FormatStyle::SpaceBeforeJsonColon, clang::format::FormatStyle::SpaceBeforeParens, clang::format::FormatStyle::SpaceBeforeParensOptions, clang::format::FormatStyle::SpaceBeforeRangeBasedForLoopColon, clang::format::FormatStyle::SpaceBeforeSquareBrackets, clang::format::FormatStyle::SpaceInEmptyBraces, clang::format::FormatStyle::SpacesBeforeTrailingComments, clang::format::FormatStyle::SpacesInAngles, clang::format::FormatStyle::SpacesInContainerLiterals, clang::format::FormatStyle::SpacesInLineCommentPrefix, clang::format::FormatStyle::SpacesInParens, clang::format::FormatStyle::SpacesInSquareBrackets, clang::format::FormatStyle::SRS_EmptyAndAttached, clang::format::FormatStyle::Standard, clang::format::FormatStyle::StatementAttributeLikeMacros, clang::format::FormatStyle::StatementMacros, clang::format::FormatStyle::SUD_LexicographicNumeric, clang::format::FormatStyle::TableGenBreakingDAGArgOperators, clang::format::FormatStyle::TableGenBreakInsideDAGArg, clang::format::FormatStyle::TabWidth, clang::format::FormatStyle::TCAS_Always, clang::format::FormatStyle::TCS_None, clang::format::FormatStyle::UseTab, clang::format::FormatStyle::UT_Never, clang::format::FormatStyle::VerilogBreakBetweenInstancePorts, clang::format::FormatStyle::WhitespaceSensitiveMacros, clang::format::FormatStyle::WNBWELS_Leave, and clang::format::FormatStyle::WrapNamespaceBodyWithEmptyLines.
Referenced by getClangFormatStyle(), getGNUStyle(), getGoogleStyle(), getMicrosoftStyle(), getMozillaStyle(), getNoStyle(), getPredefinedStyle(), getStyle(), getWebKitStyle(), guessLanguage(), and clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().
| FormatStyle clang::format::getMicrosoftStyle | ( | FormatStyle::LanguageKind | Language | ) |
Returns a format style complying with Microsoft style guide: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017.
Definition at line 2375 of file Format.cpp.
References clang::format::FormatStyle::BS_Custom, clang::format::FormatStyle::BWACS_Always, clang::format::FormatStyle::DRTBS_None, getLLVMStyle(), clang::format::FormatStyle::RTBS_None, clang::format::FormatStyle::SIS_Never, and clang::format::FormatStyle::UT_Never.
Referenced by getPredefinedStyle().
| FormatStyle clang::format::getMozillaStyle | ( | ) |
Returns a format style complying with Mozilla's style guide: https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html.
Definition at line 2309 of file Format.cpp.
References clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine, clang::format::FormatStyle::AllowShortFunctionsOnASingleLine, clang::format::FormatStyle::AlwaysBreakAfterDefinitionReturnType, clang::format::FormatStyle::BCIS_BeforeComma, clang::format::FormatStyle::BILS_BeforeComma, clang::format::FormatStyle::PackArgumentsStyle::BinPack, clang::format::FormatStyle::PackParametersStyle::BinPack, clang::format::FormatStyle::BLS_Block, clang::format::FormatStyle::BPAS_OnePerLine, clang::format::FormatStyle::BPPS_OnePerLine, clang::format::FormatStyle::BreakAfterReturnType, clang::format::FormatStyle::BreakBeforeBraces, clang::format::FormatStyle::BreakConstructorInitializers, clang::format::FormatStyle::BreakInheritanceList, clang::format::FormatStyle::BreakTemplateDeclarations, clang::format::FormatStyle::BS_Mozilla, clang::format::FormatStyle::BTDS_Yes, clang::format::FormatStyle::ConstructorInitializerIndentWidth, clang::format::FormatStyle::ContinuationIndentWidth, clang::format::FormatStyle::Cpp11BracedListStyle, clang::format::FormatStyle::DRTBS_TopLevel, clang::format::FormatStyle::FixNamespaceComments, getLLVMStyle(), clang::format::FormatStyle::IndentCaseLabels, clang::format::FormatStyle::ObjCSpaceAfterProperty, clang::format::FormatStyle::ObjCSpaceBeforeProtocolList, clang::format::FormatStyle::PackArguments, clang::format::FormatStyle::PackParameters, clang::format::FormatStyle::PAS_Left, clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine, clang::format::FormatStyle::PointerAlignment, clang::format::FormatStyle::RTBS_TopLevel, clang::format::FormatStyle::ShortFunctionStyle::setEmptyAndInline(), and clang::format::FormatStyle::SpaceAfterTemplateKeyword.
Referenced by getPredefinedStyle().
| const FormatToken * clang::format::getNamespaceToken | ( | ) | const |
Return the actual namespace token, if this token starts a namespace block.
Definition at line 949 of file FormatToken.h.
Referenced by clang::format::NamespaceEndCommentsFixer::analyze(), computeNewlines(), and getNamespaceTokenText().
| const FormatToken * clang::format::getNamespaceToken | ( | const AnnotatedLine * | Line, |
| const SmallVectorImpl< AnnotatedLine * > & | AnnotatedLines ) |
Definition at line 248 of file NamespaceEndCommentsFixer.cpp.
References clang::format::FormatToken::is(), clang::format::UnwrappedLine::kInvalidIndex, and clang::Line.
| StringRef clang::format::getNamespaceTokenText | ( | const AnnotatedLine * | Line, |
| const SmallVectorImpl< AnnotatedLine * > & | AnnotatedLines ) |
Definition at line 271 of file NamespaceEndCommentsFixer.cpp.
References getNamespaceToken(), clang::Line, and clang::format::FormatToken::TokenText.
Referenced by clang::format::NamespaceEndCommentsFixer::analyze().
|
nodiscard |
Returns the next token ignoring comments.
Definition at line 886 of file FormatToken.h.
References Tok.
| FormatStyle clang::format::getNoStyle | ( | ) |
Returns style indicating formatting should be not applied at all.
Definition at line 2418 of file Format.cpp.
References clang::format::FormatStyle::DisableFormat, getLLVMStyle(), clang::format::FormatStyle::SortIncludes, clang::format::FormatStyle::SortUsingDeclarations, and clang::format::FormatStyle::SUD_Never.
Referenced by getPredefinedStyle(), and getStyle().
| const std::error_category & clang::format::getParseCategory | ( | ) |
| bool clang::format::getPredefinedStyle | ( | StringRef | Name, |
| FormatStyle::LanguageKind | Language, | ||
| FormatStyle * | Style ) |
Gets a predefined style for the specified language by name.
Currently supported names: LLVM, Google, Chromium, Mozilla. Names are compared case-insensitively.
Returns true if the Style has been set.
Definition at line 2426 of file Format.cpp.
References getChromiumStyle(), getClangFormatStyle(), getGNUStyle(), getGoogleStyle(), getLLVMStyle(), getMicrosoftStyle(), getMozillaStyle(), getNoStyle(), and getWebKitStyle().
Referenced by getStyle(), and clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().
| struct clang::format::FormatToken clang::format::getPrevious | ( | T | A1 | ) | const |
Definition at line 235 of file FormatToken.h.
|
nodiscard |
Returns the previous token ignoring comments.
Definition at line 878 of file FormatToken.h.
References Tok.
|
nodiscard |
Definition at line 870 of file FormatToken.h.
References ForcedPrecedence, and Tok.
|
static |
Definition at line 204 of file ContinuationIndenter.cpp.
References TokenText.
|
static |
Definition at line 158 of file BreakableToken.cpp.
References Blanks(), clang::format::encoding::columnWidthWithTabs(), clang::format::encoding::getCodePointNumBytes(), clang::format::encoding::getEscapeSequenceLength(), clang::isAlphanumeric(), and clang::Text.
Referenced by clang::format::BreakableStringLiteral::getSplit().
| Expected< FormatStyle > clang::format::getStyle | ( | StringRef | StyleName, |
| StringRef | FileName, | ||
| StringRef | FallbackStyle, | ||
| StringRef | Code = "", | ||
| llvm::vfs::FileSystem * | FS = nullptr, | ||
| bool | AllowUnknownOptions = false, | ||
| llvm::SourceMgr::DiagHandlerTy | DiagHandler = nullptr ) |
Construct a FormatStyle based on StyleName.
StyleName can take several forms:
| [in] | StyleName | Style name to interpret according to the description above. |
| [in] | FileName | Path to start search for .clang-format if StyleName == "file". |
| [in] | FallbackStyle | The name of a predefined style used to fallback to in case StyleName is "file" and no file can be found. |
| [in] | Code | The actual code to be formatted. Used to determine the language if the filename isn't sufficient. |
| [in] | FS | The underlying file system, in which the file resides. By default, the file system is the real file system. |
| [in] | AllowUnknownOptions | If true, unknown format options only emit a warning. If false, errors are emitted on unknown format options. |
Definition at line 4696 of file Format.cpp.
References clang::FileName, getLanguageName(), getLLVMStyle(), getNoStyle(), getPredefinedStyle(), guessLanguage(), loadAndParseConfigFile(), make_string_error(), clang::format::FormatStyle::parseConfiguration, clang::Text, and Unsuitable.
Referenced by clang::tooling::formatAndApplyAllReplacements().
| const char * clang::format::getTokenTypeName | ( | TokenType | Type | ) |
Determines the name of a token type.
Definition at line 23 of file FormatToken.cpp.
References LIST_TOKEN_TYPES, NUM_TOKEN_TYPES, and TokNames.
| FormatStyle clang::format::getWebKitStyle | ( | ) |
Returns a format style complying with Webkit's style guide: http://www.webkit.org/coding/coding-style.html.
Definition at line 2336 of file Format.cpp.
References clang::format::FormatStyle::BCIS_BeforeComma, clang::format::FormatStyle::BLS_Block, clang::format::FormatStyle::BOS_All, clang::format::FormatStyle::BS_WebKit, getLLVMStyle(), clang::format::FormatStyle::NI_Inner, clang::format::FormatStyle::OAS_DontAlign, clang::format::FormatStyle::PAS_Left, clang::format::FormatStyle::SBS_Empty, clang::format::FormatStyle::SIEB_Always, and clang::format::FormatStyle::TCAS_Never.
Referenced by getPredefinedStyle().
| FormatStyle::LanguageKind clang::format::guessLanguage | ( | StringRef | FileName, |
| StringRef | Code ) |
Definition at line 4652 of file Format.cpp.
References clang::FileName, getLanguageByComment(), getLanguageByFileName(), getLLVMStyle(), clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_None, and clang::format::FormatStyle::LK_ObjC.
Referenced by getStyle().
Definition at line 662 of file UnwrappedLineParser.cpp.
References clang::T.
|
static |
Definition at line 1780 of file ContinuationIndenter.cpp.
References clang::format::FormatToken::is(), and Previous.
|
static |
Definition at line 335 of file WhitespaceManager.cpp.
References abs(), and SetChangeSpaces().
Referenced by AlignTokenSequence().
|
static |
Definition at line 31 of file WhitespaceManager.cpp.
References clang::format::FormatToken::AppliedIndentLevel, clang::C, getLineStart(), and clang::format::FormatToken::IndentLevel.
|
static |
Definition at line 74 of file QualifierAlignmentFixer.cpp.
References clang::First, clang::CharSourceRange::getCharRange(), and replaceToken().
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeRight().
|
static |
Definition at line 87 of file QualifierAlignmentFixer.cpp.
References clang::First, clang::CharSourceRange::getCharRange(), and replaceToken().
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft().
|
static |
Definition at line 132 of file ContinuationIndenter.cpp.
References clang::prec::Conditional, clang::Token::is(), and clang::prec::PointerToMember.
Referenced by mustBreakBinaryOperation(), and startsNextOperand().
|
static |
Definition at line 5824 of file TokenAnnotator.cpp.
|
static |
Definition at line 5842 of file TokenAnnotator.cpp.
|
nodiscard |
Returns true if this token ends a block indented initializer list.
Definition at line 66 of file FormatToken.cpp.
References BK_BracedInit, clang::format::FormatStyle::BLS_Block, clang::format::FormatToken::is(), and MatchingParen.
|
static |
Definition at line 1321 of file UnwrappedLineParser.cpp.
References isC78ParameterDecl(), isC78Type(), clang::format::FormatToken::isNot(), Next, clang::format::FormatToken::Previous, and Tok.
Referenced by isC78ParameterDecl().
|
static |
Definition at line 1308 of file UnwrappedLineParser.cpp.
References isC78Type(), and Tok.
Referenced by isC78ParameterDecl(), and isC78Type().
| bool clang::format::isClangFormatOff | ( | StringRef | Comment | ) |
Definition at line 4916 of file Format.cpp.
References isClangFormatOnOff().
Referenced by clang::format::IntegerLiteralSeparatorFixer::process(), clang::format::NumericLiteralCaseFixer::process(), clang::format::TokenAnnotator::setCommentLineLevels(), sortCppIncludes(), and sortJavaImports().
| bool clang::format::isClangFormatOn | ( | StringRef | Comment | ) |
Definition at line 4912 of file Format.cpp.
References isClangFormatOnOff().
Referenced by clang::format::JavaScriptImportSorter::analyze(), clang::format::IntegerLiteralSeparatorFixer::process(), clang::format::NumericLiteralCaseFixer::process(), sortCppIncludes(), and sortJavaImports().
Definition at line 4900 of file Format.cpp.
References clang::On.
Referenced by isClangFormatOff(), and isClangFormatOn().
|
static |
Definition at line 155 of file QualifierAlignmentFixer.cpp.
References Tok.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), and isConfiguredQualifierOrType().
| bool clang::format::isConfiguredQualifierOrType | ( | const FormatToken * | Tok, |
| const std::vector< tok::TokenKind > & | Qualifiers, | ||
| const LangOptions & | LangOpts ) |
Definition at line 643 of file QualifierAlignmentFixer.cpp.
References isConfiguredQualifier(), and Tok.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft().
Returns whether the token is the left square bracket of a C++ structured binding declaration.
Definition at line 929 of file FormatToken.h.
References TokenText.
|
static |
Definition at line 3820 of file TokenAnnotator.cpp.
References Tok.
Referenced by clang::format::TokenAnnotator::annotate().
|
static |
Definition at line 5837 of file TokenAnnotator.cpp.
References clang::format::FormatStyle::SLS_None, and Tok.
|
static |
Definition at line 5830 of file TokenAnnotator.cpp.
References Tok.
|
static |
Definition at line 3904 of file TokenAnnotator.cpp.
References clang::format::FormatToken::is(), clang::format::FormatToken::isNoneOf(), clang::format::FormatToken::isNot(), clang::Line, clang::format::FormatToken::NestingLevel, clang::format::FormatToken::Next, Next, Previous, and Tok.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation().
|
static |
Definition at line 920 of file UnwrappedLineParser.cpp.
References isGoogScope(), and clang::Line.
Referenced by isGoogScope().
|
static |
Definition at line 938 of file UnwrappedLineParser.cpp.
References isIIFE(), clang::AdditionalKeywords::kw_function, and clang::Line.
Referenced by isIIFE().
|
static |
Definition at line 1288 of file UnwrappedLineParser.cpp.
References isJSDeclOrStmt(), clang::format::FormatToken::isOneOf(), clang::AdditionalKeywords::kw_async, clang::AdditionalKeywords::kw_finally, clang::AdditionalKeywords::kw_function, clang::AdditionalKeywords::kw_import, clang::AdditionalKeywords::kw_let, clang::AdditionalKeywords::kw_var, and clang::AdditionalKeywords::kw_yield.
Referenced by isJSDeclOrStmt().
| bool clang::format::isLikelyXml | ( | StringRef | Code | ) |
Definition at line 4080 of file Format.cpp.
Referenced by clang::format::internal::reformat(), and sortIncludes().
| bool clang::format::isMpegTS | ( | StringRef | Code | ) |
Definition at line 4073 of file Format.cpp.
Referenced by clang::format::internal::reformat(), and sortIncludes().
|
static |
Definition at line 25 of file NumericLiteralCaseFixer.cpp.
References clang::format::FormatStyle::LK_C, clang::format::FormatStyle::LK_Cpp, clang::format::FormatStyle::LK_CSharp, clang::format::FormatStyle::LK_Java, clang::format::FormatStyle::LK_JavaScript, clang::format::FormatStyle::LK_ObjC, and clang::format::FormatStyle::NLCS_Leave.
Referenced by clang::format::NumericLiteralCaseFixer::process().
Returns true if this token likely names an object-like macro.
If AllowFollowingColonColon is true, a following :: does not disqualify the token from being considered macro-like.
Definition at line 897 of file FormatToken.h.
|
static |
Definition at line 160 of file QualifierAlignmentFixer.cpp.
References Tok.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(), and isQualifierOrType().
| bool clang::format::isQualifierOrType | ( | const FormatToken * | Tok, |
| const LangOptions & | LangOpts ) |
Definition at line 638 of file QualifierAlignmentFixer.cpp.
References isQualifier(), and Tok.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeRight().
|
static |
Definition at line 812 of file FormatTokenLexer.cpp.
| llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > clang::format::loadAndParseConfigFile | ( | StringRef | ConfigFile, |
| llvm::vfs::FileSystem * | FS, | ||
| FormatStyle * | Style, | ||
| bool | AllowUnknownOptions, | ||
| llvm::SourceMgr::DiagHandlerTy | DiagHandler, | ||
| bool | IsDotHFile ) |
Definition at line 4680 of file Format.cpp.
References clang::format::FormatStyle::parseConfiguration, and clang::Text.
Referenced by getStyle().
| std::error_code clang::format::make_error_code | ( | ParseError | e | ) |
Definition at line 1680 of file Format.cpp.
References getParseCategory().
Referenced by clang::format::FormatStyle::parseConfiguration.
|
inline |
Definition at line 1684 of file Format.cpp.
Referenced by getStyle().
|
static |
Definition at line 2932 of file UnwrappedLineParser.cpp.
References clang::format::FormatToken::is(), markOptionalBraces(), clang::format::FormatToken::MatchingParen, and clang::format::FormatToken::Optional.
Referenced by markOptionalBraces().
|
static |
Test if Suffix matches a C++ literal reserved by the library.
Matches against all suffixes reserved in the C++23 standard.
Definition at line 62 of file NumericLiteralCaseFixer.cpp.
Referenced by format().
| bool clang::format::matchFilePath | ( | llvm::StringRef | Pattern, |
| llvm::StringRef | FilePath ) |
| bool clang::format::matchFilePath | ( | StringRef | Pattern, |
| StringRef | FilePath ) |
Definition at line 24 of file MatchFilePath.cpp.
References clang::C, clang::Match, and matchFilePath().
Referenced by matchFilePath().
|
static |
Definition at line 3703 of file TokenAnnotator.cpp.
References clang::Line, clang::Result, and Tok.
Referenced by clang::format::TokenAnnotator::annotate().
|
static |
Definition at line 439 of file BreakableToken.cpp.
References Blanks(), and clang::isPunctuation().
Referenced by clang::format::BreakableBlockComment::mayReflow(), and clang::format::BreakableLineCommentSection::mayReflow().
|
static |
Definition at line 1264 of file UnwrappedLineParser.cpp.
References clang::Token::getIdentifierInfo(), clang::format::FormatToken::is(), clang::format::FormatToken::isNoneOf(), clang::AdditionalKeywords::kw_abstract, clang::AdditionalKeywords::kw_as, clang::AdditionalKeywords::kw_async, clang::AdditionalKeywords::kw_await, clang::AdditionalKeywords::kw_extends, clang::AdditionalKeywords::kw_finally, clang::AdditionalKeywords::kw_from, clang::AdditionalKeywords::kw_function, clang::AdditionalKeywords::kw_implements, clang::AdditionalKeywords::kw_import, clang::AdditionalKeywords::kw_in, clang::AdditionalKeywords::kw_instanceof, clang::AdditionalKeywords::kw_interface, clang::AdditionalKeywords::kw_is, clang::AdditionalKeywords::kw_let, clang::AdditionalKeywords::kw_of, clang::AdditionalKeywords::kw_override, clang::AdditionalKeywords::kw_throws, clang::AdditionalKeywords::kw_var, clang::AdditionalKeywords::kw_yield, mustBeJSIdent(), and clang::format::FormatToken::Tok.
Referenced by mustBeJSIdent(), and mustBeJSIdentOrValue().
|
static |
Definition at line 1279 of file UnwrappedLineParser.cpp.
References clang::Token::isLiteral(), clang::format::FormatToken::isOneOf(), mustBeJSIdent(), mustBeJSIdentOrValue(), and clang::format::FormatToken::Tok.
Referenced by mustBeJSIdentOrValue().
|
static |
Definition at line 26 of file TokenAnnotator.cpp.
References clang::format::FormatStyle::ABS_Always, clang::format::FormatStyle::ABS_Never, and Tok.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation().
|
static |
Definition at line 157 of file ContinuationIndenter.cpp.
References clang::format::FormatStyle::BBO_Never, clang::format::FormatStyle::BOS_None, clang::format::FormatToken::CanBreakBefore, getChainLength(), clang::Token::getKind(), isAlignableBinaryOperator(), clang::format::FormatToken::Previous, startsNextOperand(), and clang::format::FormatToken::Tok.
|
nodiscard |
Returns true if this tokens starts a block-type list, i.e. a list that should be indented with a block indent.
Definition at line 82 of file FormatToken.cpp.
References BK_Block, BK_BracedInit, clang::format::FormatStyle::BLS_Block, clang::format::FormatToken::getBlockKind(), clang::format::FormatToken::is(), and NestingLevel.
|
static |
Definition at line 191 of file ContinuationIndenter.cpp.
References clang::format::FormatToken::is(), clang::format::FormatToken::isNot(), clang::format::FormatStyle::LK_Proto, clang::format::FormatToken::NestingLevel, and clang::format::FormatToken::Previous.
Referenced by clang::format::ContinuationIndenter::mustBreak().
| bool clang::format::operator< | ( | const JsModuleReference & | LHS, |
| const JsModuleReference & | RHS ) |
Definition at line 101 of file SortJavaScriptImports.cpp.
References clang::format::JsModuleReference::ALIAS, clang::format::JsModuleReference::Category, clang::format::JsModuleReference::IsExport, clang::format::JsModuleReference::Prefix, clang::format::JsModuleReference::SIDE_EFFECT, and clang::format::JsModuleReference::URL.
| std::ostream & clang::format::operator<< | ( | std::ostream & | Stream, |
| const UnwrappedLine & | Line ) |
Definition at line 90 of file UnwrappedLineParser.cpp.
References clang::Line.
| std::error_code clang::format::parseConfiguration | ( | llvm::MemoryBufferRef | Config, |
| FormatStyle * | Style, | ||
| bool | AllowUnknownOptions = false, | ||
| llvm::SourceMgr::DiagHandlerTy | DiagHandler = nullptr, | ||
| void * | DiagHandlerCtx = nullptr, | ||
| bool | IsDotHFile = false ) |
Parse configuration from YAML-formatted text.
Style->Language is used to get the base style, if the BasedOnStyle option is present.
The FormatStyleSet of Style is reset.
When BasedOnStyle is not present, options not present in the YAML document, are retained in Style.
If AllowUnknownOptions is true, no errors are emitted if unknown format options are occurred.
If set all diagnostics are emitted through the DiagHandler.
Definition at line 2491 of file Format.cpp.
Referenced by parseConfiguration().
|
inline |
Like above but accepts an unnamed buffer.
Definition at line 6409 of file Format.h.
References parseConfiguration().
| void clang::format::prepareLeftRightOrderingForQualifierAlignmentFixer | ( | const std::vector< std::string > & | Order, |
| std::vector< std::string > & | LeftOrder, | ||
| std::vector< std::string > & | RightOrder, | ||
| std::vector< tok::TokenKind > & | Qualifiers ) |
Definition at line 604 of file QualifierAlignmentFixer.cpp.
References clang::format::LeftRightQualifierAlignmentFixer::getTokenFromQualifier().
Referenced by addQualifierAlignmentFixerPasses().
|
static |
Definition at line 4104 of file Format.cpp.
References clang::tooling::Replacements::begin(), clang::tooling::Replacements::empty(), clang::FileName, clang::tooling::Replacements::getAffectedRanges(), clang::tooling::Replacements::merge(), and clang::T.
Referenced by cleanupAroundReplacements(), and formatReplacements().
| tooling::Replacements clang::format::reformat | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName, | ||
| bool * | IncompleteFormat ) |
Same as above, except if IncompleteFormat is non-null, its value will be set to true if any of the affected ranges were not formatted due to a non-recoverable syntax error.
Definition at line 4480 of file Format.cpp.
References clang::FileName, reformat(), and clang::Result.
| tooling::Replacements clang::format::reformat | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName = "<stdin>", | ||
| FormattingAttemptStatus * | Status = nullptr ) |
Reformats the given Ranges in Code.
Each range is extended on either end to its next bigger logic unit, i.e. everything that might influence its formatting or might be influenced by its formatting.
Returns the Replacements necessary to make all Ranges comply with Style.
If Status is non-null, its value will be populated with the status of this formatting attempt. See FormattingAttemptStatus.
Definition at line 4457 of file Format.cpp.
References clang::FileName, and clang::format::internal::reformat().
Referenced by clang::tooling::applyAtomicChanges(), formatReplacements(), and reformat().
|
static |
Definition at line 66 of file QualifierAlignmentFixer.cpp.
References clang::First, clang::CharSourceRange::getCharRange(), and replaceToken().
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft().
| std::string clang::format::replaceCRLF | ( | const std::string & | Code | ) |
Definition at line 3612 of file Format.cpp.
Referenced by sortCppIncludes(), and sortJavaImports().
|
static |
Definition at line 54 of file QualifierAlignmentFixer.cpp.
References clang::tooling::Replacements::add().
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(), insertQualifierAfter(), insertQualifierBefore(), removeToken(), and rotateTokens().
|
static |
Definition at line 112 of file QualifierAlignmentFixer.cpp.
References endsWithSpace(), clang::First, clang::CharSourceRange::getCharRange(), clang::Last, replaceToken(), startsWithSpace(), and Tok.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), and clang::format::LeftRightQualifierAlignmentFixer::analyzeRight().
| tooling::Replacements clang::format::separateDefinitionBlocks | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName = "<stdin>" ) |
Inserts or removes empty lines separating definition blocks including classes, structs, functions, namespaces, and enums in the given Ranges in Code.
Returns the Replacements that inserts or removes empty lines separating definition blocks in all Ranges in Code.
References DefaultFallbackStyle, DefaultFormatStyle, clang::FileName, and StyleOptionHelpDescription.
|
static |
Definition at line 308 of file WhitespaceManager.cpp.
Referenced by IncrementChangeSpaces().
|
static |
Definition at line 956 of file UnwrappedLineParser.cpp.
References clang::Token::getKind(), clang::format::FormatToken::is(), ShouldBreakBeforeBrace(), clang::format::FormatStyle::SRS_Empty, and clang::format::FormatToken::Tok.
Referenced by ShouldBreakBeforeBrace().
|
static |
Definition at line 34 of file ContinuationIndenter.cpp.
References LT_ObjCMethodDecl.
|
static |
Definition at line 41 of file ContinuationIndenter.cpp.
References clang::prec::Assignment, Previous, and Tok.
|
static |
Definition at line 3712 of file TokenAnnotator.cpp.
References Tok.
Referenced by getFunctionName().
|
static |
Definition at line 3640 of file Format.cpp.
References clang::tooling::Replacements::add(), affectsRange(), Cmp, clang::FileName, FindCursorIndex(), clang::tooling::IncludeStyle::IBS_Preserve, clang::tooling::IncludeStyle::IBS_Regroup, replaceCRLF(), and toString().
Referenced by sortCppIncludes(), and sortIncludes().
| tooling::Replacements clang::format::sortCppIncludes | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName, | ||
| tooling::Replacements & | Replaces, | ||
| unsigned * | Cursor ) |
Definition at line 3776 of file Format.cpp.
References clang::FileName, clang::tooling::IncludeCategoryManager::getIncludePriority(), clang::tooling::IncludeCategoryManager::getSortIncludePriority(), clang::tooling::IncludeStyle::IBS_Merge, clang::tooling::IncludeStyle::IBS_Regroup, clang::tooling::HeaderIncludes::IncludeRegex, isClangFormatOff(), isClangFormatOn(), clang::Line, clang::ast_matchers::match(), and sortCppIncludes().
| tooling::Replacements clang::format::sortIncludes | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName, | ||
| unsigned * | Cursor = nullptr ) |
Returns the replacements necessary to sort all #include blocks that are affected by Ranges.
Definition at line 4082 of file Format.cpp.
References clang::FileName, isLikelyXml(), isMpegTS(), sortCppIncludes(), sortJavaImports(), and sortJavaScriptImports().
Referenced by clang::tooling::applyAtomicChanges(), and formatReplacements().
|
static |
Definition at line 3919 of file Format.cpp.
References clang::tooling::Replacements::add(), affectsRange(), clang::FileName, findJavaImportGroup(), clang::format::FormatStyle::JavaImportGroups, replaceCRLF(), clang::format::FormatStyle::SJSIO_After, and toString().
Referenced by sortIncludes(), and sortJavaImports().
| tooling::Replacements clang::format::sortJavaImports | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName, | ||
| tooling::Replacements & | Replaces ) |
Definition at line 4003 of file Format.cpp.
References clang::FileName, isClangFormatOff(), isClangFormatOn(), clang::Line, sortJavaImports(), and clang::Static.
| tooling::Replacements clang::format::sortJavaScriptImports | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName ) |
Definition at line 586 of file SortJavaScriptImports.cpp.
References clang::FileName, clang::format::Environment::make(), and clang::format::TokenAnalyzer::process().
Referenced by sortIncludes().
| tooling::Replacements clang::format::sortUsingDeclarations | ( | const FormatStyle & | Style, |
| StringRef | Code, | ||
| ArrayRef< tooling::Range > | Ranges, | ||
| StringRef | FileName = "<stdin>" ) |
Sort consecutive using declarations in the given Ranges in Code.
Returns the Replacements that sort the using declarations in all Ranges in Code.
Definition at line 4500 of file Format.cpp.
References clang::FileName, clang::format::Environment::make(), and clang::format::TokenAnalyzer::process().
|
static |
Definition at line 141 of file ContinuationIndenter.cpp.
References isAlignableBinaryOperator(), clang::format::FormatToken::Previous, and Previous.
Referenced by mustBreakBinaryOperation().
| bool clang::format::startsNextParameter | ( | const FormatToken & | Current, |
| const FormatStyle & | Style ) |
Definition at line 338 of file FormatToken.cpp.
References clang::format::FormatStyle::BCIS_BeforeComma, clang::format::FormatStyle::BILS_BeforeComma, clang::format::FormatToken::is(), clang::format::FormatStyle::LK_Proto, clang::format::FormatToken::Previous, and Previous.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation(), and clang::format::ContinuationIndenter::mustBreak().
|
static |
Definition at line 127 of file ContinuationIndenter.cpp.
References Tok.
Referenced by clang::format::ContinuationIndenter::mustBreak().
|
static |
Definition at line 106 of file QualifierAlignmentFixer.cpp.
Referenced by rotateTokens().
| bool clang::format::switchesFormatting | ( | const FormatToken & | Token | ) |
Checks if Token switches formatting, like /* clang-format off */.
Token must be a comment.
Definition at line 206 of file BreakableToken.cpp.
References clang::Token::is().
Referenced by clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), clang::format::BreakableBlockComment::mayReflow(), and clang::format::BreakableLineCommentSection::mayReflow().
|
static |
Definition at line 1243 of file UnwrappedLineParser.cpp.
References Tok, and tokenCanStartNewLine().
Referenced by tokenCanStartNewLine().
|
static |
Definition at line 47 of file NumericLiteralCaseFixer.cpp.
References clang::format::FormatStyle::NLCS_Lower, and clang::format::FormatStyle::NLCS_Upper.
Referenced by format().
| ParseError clang::format::validateQualifierOrder | ( | FormatStyle * | Style | ) |
Definition at line 2459 of file Format.cpp.
References DuplicateQualifierSpecified, clang::format::LeftRightQualifierAlignmentFixer::getTokenFromQualifier(), InvalidQualifierSpecified, MissingQualifierOrder, MissingQualifierType, and Success.
Referenced by clang::format::FormatStyle::parseConfiguration.
|
staticconstexpr |
Definition at line 48 of file FormatToken.cpp.
| const char * clang::format::DefaultFallbackStyle = "LLVM" |
The suggested predefined style to use as the fallback style in getStyle.
Different builds can modify the value to the preferred styles.
Definition at line 4677 of file Format.cpp.
Referenced by separateDefinitionBlocks().
| const char * clang::format::DefaultFormatStyle = "file" |
The suggested format style to use by default.
This allows tools using getStyle to have a consistent default style. Different builds can modify the value to the preferred styles.
Definition at line 4675 of file Format.cpp.
Referenced by separateDefinitionBlocks().
|
staticconstexpr |
Definition at line 36 of file FormatToken.cpp.
| const char * clang::format::StyleOptionHelpDescription |
Description to be used for help text for a llvm::cl option for specifying format style.
The description is closely related to the operation of getStyle().
Definition at line 4556 of file Format.cpp.
Referenced by separateDefinitionBlocks().