diff options
Diffstat (limited to 'clang/lib/Format')
29 files changed, 260 insertions, 260 deletions
diff --git a/clang/lib/Format/AffectedRangeManager.cpp b/clang/lib/Format/AffectedRangeManager.cpp index 02e9f5e46f1..b14316a14cd 100644 --- a/clang/lib/Format/AffectedRangeManager.cpp +++ b/clang/lib/Format/AffectedRangeManager.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements AffectRangeManager class. +/// This file implements AffectRangeManager class. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/AffectedRangeManager.h b/clang/lib/Format/AffectedRangeManager.h index b9a0cadd40a..b0c9dd259fb 100644 --- a/clang/lib/Format/AffectedRangeManager.h +++ b/clang/lib/Format/AffectedRangeManager.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief AffectedRangeManager class manages affected ranges in the code. +/// AffectedRangeManager class manages affected ranges in the code. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp index b603067ab3e..db39a95bb1d 100644 --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief Contains implementation of BreakableToken class and classes derived +/// Contains implementation of BreakableToken class and classes derived /// from it. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index 1af031145cc..d9713be3980 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief Declares BreakableToken, BreakableStringLiteral, BreakableComment, +/// Declares BreakableToken, BreakableStringLiteral, BreakableComment, /// BreakableBlockComment and BreakableLineCommentSection classes, that contain /// token type-specific logic to break long lines in tokens and reflow content /// between tokens. @@ -27,13 +27,13 @@ namespace clang { namespace format { -/// \brief Checks if \p Token switches formatting, like /* clang-format off */. +/// Checks if \p Token switches formatting, like /* clang-format off */. /// \p Token must be a comment. bool switchesFormatting(const FormatToken &Token); struct FormatStyle; -/// \brief Base class for tokens / ranges of tokens that can allow breaking +/// 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. /// @@ -88,15 +88,15 @@ struct FormatStyle; /// class BreakableToken { public: - /// \brief Contains starting character index and length of split. + /// Contains starting character index and length of split. typedef std::pair<StringRef::size_type, unsigned> Split; virtual ~BreakableToken() {} - /// \brief Returns the number of lines in this token in the original code. + /// Returns the number of lines in this token in the original code. virtual unsigned getLineCount() const = 0; - /// \brief Returns the number of columns required to format the text in the + /// Returns the number of columns required to format the text in the /// byte range [\p Offset, \p Offset \c + \p Length). /// /// \p Offset is the byte offset from the start of the content of the line @@ -108,7 +108,7 @@ public: StringRef::size_type Length, unsigned StartColumn) const = 0; - /// \brief Returns the number of columns required to format the text following + /// Returns the number of columns required to format the text following /// the byte \p Offset in the line \p LineIndex, including potentially /// unbreakable sequences of tokens following after the end of the token. /// @@ -125,7 +125,7 @@ public: return getRangeLength(LineIndex, Offset, StringRef::npos, StartColumn); } - /// \brief Returns the column at which content in line \p LineIndex starts, + /// Returns the column at which content in line \p LineIndex starts, /// assuming no reflow. /// /// If \p Break is true, returns the column at which the line should start @@ -135,7 +135,7 @@ public: virtual unsigned getContentStartColumn(unsigned LineIndex, bool Break) const = 0; - /// \brief Returns a range (offset, length) at which to break the line at + /// Returns a range (offset, length) at which to break the line at /// \p LineIndex, if previously broken at \p TailOffset. If possible, do not /// violate \p ColumnLimit, assuming the text starting at \p TailOffset in /// the token is formatted starting at ContentStartColumn in the reformatted @@ -144,27 +144,27 @@ public: unsigned ColumnLimit, unsigned ContentStartColumn, llvm::Regex &CommentPragmasRegex) const = 0; - /// \brief Emits the previously retrieved \p Split via \p Whitespaces. + /// Emits the previously retrieved \p Split via \p Whitespaces. virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) const = 0; - /// \brief Returns the number of columns needed to format + /// Returns the number of columns needed to format /// \p RemainingTokenColumns, assuming that Split is within the range measured /// by \p RemainingTokenColumns, and that the whitespace in Split is reduced /// to a single space. unsigned getLengthAfterCompression(unsigned RemainingTokenColumns, Split Split) const; - /// \brief Replaces the whitespace range described by \p Split with a single + /// Replaces the whitespace range described by \p Split with a single /// space. virtual void compressWhitespace(unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) const = 0; - /// \brief Returns whether the token supports reflowing text. + /// Returns whether the token supports reflowing text. virtual bool supportsReflow() const { return false; } - /// \brief Returns a whitespace range (offset, length) of the content at \p + /// Returns a whitespace range (offset, length) of the content at \p /// LineIndex such that the content of that line is reflown to the end of the /// previous one. /// @@ -180,21 +180,21 @@ public: return Split(StringRef::npos, 0); } - /// \brief Reflows the current line into the end of the previous one. + /// Reflows the current line into the end of the previous one. virtual void reflow(unsigned LineIndex, WhitespaceManager &Whitespaces) const {} - /// \brief Returns whether there will be a line break at the start of the + /// Returns whether there will be a line break at the start of the /// token. virtual bool introducesBreakBeforeToken() const { return false; } - /// \brief Replaces the whitespace between \p LineIndex-1 and \p LineIndex. + /// Replaces the whitespace between \p LineIndex-1 and \p LineIndex. virtual void adaptStartOfLine(unsigned LineIndex, WhitespaceManager &Whitespaces) const {} - /// \brief Returns a whitespace range (offset, length) of the content at + /// Returns a whitespace range (offset, length) of the content at /// the last line that needs to be reformatted after the last line has been /// reformatted. /// @@ -204,7 +204,7 @@ public: return Split(StringRef::npos, 0); } - /// \brief Replaces the whitespace from \p SplitAfterLastLine on the last line + /// Replaces the whitespace from \p SplitAfterLastLine on the last line /// after the last line has been formatted by performing a reformatting. void replaceWhitespaceAfterLastLine(unsigned TailOffset, Split SplitAfterLastLine, @@ -213,7 +213,7 @@ public: Whitespaces); } - /// \brief Updates the next token of \p State to the next token after this + /// Updates the next token of \p State to the next token after this /// one. This can be used when this token manages a set of underlying tokens /// as a unit and is responsible for the formatting of the them. virtual void updateNextToken(LineState &State) const {} @@ -232,7 +232,7 @@ protected: class BreakableStringLiteral : public BreakableToken { public: - /// \brief Creates a breakable token for a single line string literal. + /// Creates a breakable token for a single line string literal. /// /// \p StartColumn specifies the column in which the token will start /// after formatting. @@ -272,7 +272,7 @@ protected: class BreakableComment : public BreakableToken { protected: - /// \brief Creates a breakable token for a comment. + /// Creates a breakable token for a comment. /// /// \p StartColumn specifies the column in which the comment will start after /// formatting. @@ -453,7 +453,7 @@ private: SmallVector<unsigned, 16> OriginalContentColumn; - /// \brief The token to which the last line of this breakable token belongs + /// The token to which the last line of this breakable token belongs /// to; nullptr if that token is the initial token. /// /// The distinction is because if the token of the last line of this breakable diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 75b13270325..9262dc3fdd5 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements the continuation indenter. +/// This file implements the continuation indenter. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/ContinuationIndenter.h b/clang/lib/Format/ContinuationIndenter.h index 64b3a3eba9f..3e09303d280 100644 --- a/clang/lib/Format/ContinuationIndenter.h +++ b/clang/lib/Format/ContinuationIndenter.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements an indenter that manages the indentation of +/// This file implements an indenter that manages the indentation of /// continuations. /// //===----------------------------------------------------------------------===// @@ -50,7 +50,7 @@ struct RawStringFormatStyleManager { class ContinuationIndenter { public: - /// \brief Constructs a \c ContinuationIndenter to format \p Line starting in + /// Constructs a \c ContinuationIndenter to format \p Line starting in /// column \p FirstIndent. ContinuationIndenter(const FormatStyle &Style, const AdditionalKeywords &Keywords, @@ -59,7 +59,7 @@ public: encoding::Encoding Encoding, bool BinPackInconclusiveFunctions); - /// \brief Get the initial state, i.e. the state after placing \p Line's + /// Get the initial state, i.e. the state after placing \p Line's /// first token at \p FirstIndent. When reformatting a fragment of code, as in /// the case of formatting inside raw string literals, \p FirstStartColumn is /// the column at which the state of the parent formatter is. @@ -68,13 +68,13 @@ public: // FIXME: canBreak and mustBreak aren't strictly indentation-related. Find a // better home. - /// \brief Returns \c true, if a line break after \p State is allowed. + /// Returns \c true, if a line break after \p State is allowed. bool canBreak(const LineState &State); - /// \brief Returns \c true, if a line break after \p State is mandatory. + /// Returns \c true, if a line break after \p State is mandatory. bool mustBreak(const LineState &State); - /// \brief Appends the next token to \p State and updates information + /// Appends the next token to \p State and updates information /// necessary for indentation. /// /// Puts the token on the current line if \p Newline is \c false and adds a @@ -85,28 +85,28 @@ public: unsigned addTokenToState(LineState &State, bool Newline, bool DryRun, unsigned ExtraSpaces = 0); - /// \brief Get the column limit for this line. This is the style's column + /// Get the column limit for this line. This is the style's column /// limit, potentially reduced for preprocessor definitions. unsigned getColumnLimit(const LineState &State) const; private: - /// \brief Mark the next token as consumed in \p State and modify its stacks + /// Mark the next token as consumed in \p State and modify its stacks /// accordingly. unsigned moveStateToNextToken(LineState &State, bool DryRun, bool Newline); - /// \brief Update 'State' according to the next token's fake left parentheses. + /// Update 'State' according to the next token's fake left parentheses. void moveStatePastFakeLParens(LineState &State, bool Newline); - /// \brief Update 'State' according to the next token's fake r_parens. + /// Update 'State' according to the next token's fake r_parens. void moveStatePastFakeRParens(LineState &State); - /// \brief Update 'State' according to the next token being one of "(<{[". + /// Update 'State' according to the next token being one of "(<{[". void moveStatePastScopeOpener(LineState &State, bool Newline); - /// \brief Update 'State' according to the next token being one of ")>}]". + /// Update 'State' according to the next token being one of ")>}]". void moveStatePastScopeCloser(LineState &State); - /// \brief Update 'State' with the next token opening a nested block. + /// Update 'State' with the next token opening a nested block. void moveStateToNewBlock(LineState &State); - /// \brief Reformats a raw string literal. + /// Reformats a raw string literal. /// /// \returns An extra penalty induced by reformatting the token. unsigned reformatRawStringLiteral(const FormatToken &Current, @@ -114,17 +114,17 @@ private: const FormatStyle &RawStringStyle, bool DryRun); - /// \brief If the current token is at the end of the current line, handle + /// If the current token is at the end of the current line, handle /// the transition to the next line. unsigned handleEndOfLine(const FormatToken &Current, LineState &State, bool DryRun, bool AllowBreak); - /// \brief If \p Current is a raw string that is configured to be reformatted, + /// If \p Current is a raw string that is configured to be reformatted, /// return the style to be used. llvm::Optional<FormatStyle> getRawStringStyle(const FormatToken &Current, const LineState &State); - /// \brief If the current token sticks out over the end of the line, break + /// If the current token sticks out over the end of the line, break /// it if possible. /// /// \returns A pair (penalty, exceeded), where penalty is the extra penalty @@ -147,13 +147,13 @@ private: bool AllowBreak, bool DryRun, bool Strict); - /// \brief Returns the \c BreakableToken starting at \p Current, or nullptr + /// Returns the \c BreakableToken starting at \p Current, or nullptr /// if the current token cannot be broken. std::unique_ptr<BreakableToken> createBreakableToken(const FormatToken &Current, LineState &State, bool AllowBreak); - /// \brief Appends the next token to \p State and updates information + /// Appends the next token to \p State and updates information /// necessary for indentation. /// /// Puts the token on the current line. @@ -163,7 +163,7 @@ private: void addTokenOnCurrentLine(LineState &State, bool DryRun, unsigned ExtraSpaces); - /// \brief Appends the next token to \p State and updates information + /// Appends the next token to \p State and updates information /// necessary for indentation. /// /// Adds a line break and necessary indentation. @@ -172,17 +172,17 @@ private: /// \c Replacement. unsigned addTokenOnNewLine(LineState &State, bool DryRun); - /// \brief Calculate the new column for a line wrap before the next token. + /// Calculate the new column for a line wrap before the next token. unsigned getNewLineColumn(const LineState &State); - /// \brief Adds a multiline token to the \p State. + /// Adds a multiline token to the \p State. /// /// \returns Extra penalty for the first line of the literal: last line is /// handled in \c addNextStateToQueue, and the penalty for other lines doesn't /// matter, as we don't change them. unsigned addMultilineToken(const FormatToken &Current, LineState &State); - /// \brief Returns \c true if the next token starts a multiline string + /// Returns \c true if the next token starts a multiline string /// literal. /// /// This includes implicitly concatenated strings, strings that will be broken @@ -211,115 +211,115 @@ struct ParenState { HasMultipleNestedBlocks(false), NestedBlockInlined(false), IsInsideObjCArrayLiteral(false) {} - /// \brief The position to which a specific parenthesis level needs to be + /// The position to which a specific parenthesis level needs to be /// indented. unsigned Indent; - /// \brief The position of the last space on each level. + /// The position of the last space on each level. /// /// Used e.g. to break like: /// functionCall(Parameter, otherCall( /// OtherParameter)); unsigned LastSpace; - /// \brief If a block relative to this parenthesis level gets wrapped, indent + /// If a block relative to this parenthesis level gets wrapped, indent /// it this much. unsigned NestedBlockIndent; - /// \brief The position the first "<<" operator encountered on each level. + /// The position the first "<<" operator encountered on each level. /// /// Used to align "<<" operators. 0 if no such operator has been encountered /// on a level. unsigned FirstLessLess = 0; - /// \brief The column of a \c ? in a conditional expression; + /// The column of a \c ? in a conditional expression; unsigned QuestionColumn = 0; - /// \brief The position of the colon in an ObjC method declaration/call. + /// The position of the colon in an ObjC method declaration/call. unsigned ColonPos = 0; - /// \brief The start of the most recent function in a builder-type call. + /// The start of the most recent function in a builder-type call. unsigned StartOfFunctionCall = 0; - /// \brief Contains the start of array subscript expressions, so that they + /// Contains the start of array subscript expressions, so that they /// can be aligned. unsigned StartOfArraySubscripts = 0; - /// \brief If a nested name specifier was broken over multiple lines, this + /// If a nested name specifier was broken over multiple lines, this /// contains the start column of the second line. Otherwise 0. unsigned NestedNameSpecifierContinuation = 0; - /// \brief If a call expression was broken over multiple lines, this + /// If a call expression was broken over multiple lines, this /// contains the start column of the second line. Otherwise 0. unsigned CallContinuation = 0; - /// \brief The column of the first variable name in a variable declaration. + /// The column of the first variable name in a variable declaration. /// /// Used to align further variables if necessary. unsigned VariablePos = 0; - /// \brief Whether a newline needs to be inserted before the block's closing + /// Whether a newline needs to be inserted before the block's closing /// brace. /// /// We only want to insert a newline before the closing brace if there also /// was a newline after the beginning left brace. bool BreakBeforeClosingBrace : 1; - /// \brief Avoid bin packing, i.e. multiple parameters/elements on multiple + /// Avoid bin packing, i.e. multiple parameters/elements on multiple /// lines, in this context. bool AvoidBinPacking : 1; - /// \brief Break after the next comma (or all the commas in this context if + /// Break after the next comma (or all the commas in this context if /// \c AvoidBinPacking is \c true). bool BreakBeforeParameter : 1; - /// \brief Line breaking in this context would break a formatting rule. + /// Line breaking in this context would break a formatting rule. bool NoLineBreak : 1; - /// \brief Same as \c NoLineBreak, but is restricted until the end of the + /// Same as \c NoLineBreak, but is restricted until the end of the /// operand (including the next ","). bool NoLineBreakInOperand : 1; - /// \brief True if the last binary operator on this level was wrapped to the + /// True if the last binary operator on this level was wrapped to the /// next line. bool LastOperatorWrapped : 1; - /// \brief \c true if this \c ParenState already contains a line-break. + /// \c true if this \c ParenState already contains a line-break. /// /// The first line break in a certain \c ParenState causes extra penalty so /// that clang-format prefers similar breaks, i.e. breaks in the same /// parenthesis. bool ContainsLineBreak : 1; - /// \brief \c true if this \c ParenState contains multiple segments of a + /// \c true if this \c ParenState contains multiple segments of a /// builder-type call on one line. bool ContainsUnwrappedBuilder : 1; - /// \brief \c true if the colons of the curren ObjC method expression should + /// \c true if the colons of the curren ObjC method expression should /// be aligned. /// /// Not considered for memoization as it will always have the same value at /// the same token. bool AlignColons : 1; - /// \brief \c true if at least one selector name was found in the current + /// \c true if at least one selector name was found in the current /// ObjC method expression. /// /// Not considered for memoization as it will always have the same value at /// the same token. bool ObjCSelectorNameFound : 1; - /// \brief \c true if there are multiple nested blocks inside these parens. + /// \c true if there are multiple nested blocks inside these parens. /// /// Not considered for memoization as it will always have the same value at /// the same token. bool HasMultipleNestedBlocks : 1; - /// \brief The start of a nested block (e.g. lambda introducer in C++ or + /// The start of a nested block (e.g. lambda introducer in C++ or /// "function" in JavaScript) is not wrapped to a new line. bool NestedBlockInlined : 1; - /// \brief \c true if the current \c ParenState represents an Objective-C + /// \c true if the current \c ParenState represents an Objective-C /// array literal. bool IsInsideObjCArrayLiteral : 1; @@ -364,37 +364,37 @@ struct ParenState { } }; -/// \brief The current state when indenting a unwrapped line. +/// The current state when indenting a unwrapped line. /// /// As the indenting tries different combinations this is copied by value. struct LineState { - /// \brief The number of used columns in the current line. + /// The number of used columns in the current line. unsigned Column; - /// \brief The token that needs to be next formatted. + /// The token that needs to be next formatted. FormatToken *NextToken; - /// \brief \c true if this line contains a continued for-loop section. + /// \c true if this line contains a continued for-loop section. bool LineContainsContinuedForLoopSection; - /// \brief \c true if \p NextToken should not continue this line. + /// \c true if \p NextToken should not continue this line. bool NoContinuation; - /// \brief The \c NestingLevel at the start of this line. + /// The \c NestingLevel at the start of this line. unsigned StartOfLineLevel; - /// \brief The lowest \c NestingLevel on the current line. + /// The lowest \c NestingLevel on the current line. unsigned LowestLevelOnLine; - /// \brief The start column of the string literal, if we're in a string + /// The start column of the string literal, if we're in a string /// literal sequence, 0 otherwise. unsigned StartOfStringLiteral; - /// \brief A stack keeping track of properties applying to parenthesis + /// A stack keeping track of properties applying to parenthesis /// levels. std::vector<ParenState> Stack; - /// \brief Ignore the stack of \c ParenStates for state comparison. + /// Ignore the stack of \c ParenStates for state comparison. /// /// In long and deeply nested unwrapped lines, the current algorithm can /// be insufficient for finding the best formatting with a reasonable amount @@ -409,15 +409,15 @@ struct LineState { /// FIXME: Come up with a better algorithm instead. bool IgnoreStackForComparison; - /// \brief The indent of the first token. + /// The indent of the first token. unsigned FirstIndent; - /// \brief The line that is being formatted. + /// The line that is being formatted. /// /// Does not need to be considered for memoization because it doesn't change. const AnnotatedLine *Line; - /// \brief Comparison operator to be able to used \c LineState in \c map. + /// Comparison operator to be able to used \c LineState in \c map. bool operator<(const LineState &Other) const { if (NextToken != Other.NextToken) return NextToken < Other.NextToken; diff --git a/clang/lib/Format/Encoding.h b/clang/lib/Format/Encoding.h index 3339597b4ed..404a443abcf 100644 --- a/clang/lib/Format/Encoding.h +++ b/clang/lib/Format/Encoding.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief Contains functions for text encoding manipulation. Supports UTF-8, +/// Contains functions for text encoding manipulation. Supports UTF-8, /// 8-bit encodings and escape sequences in C++ string literals. /// //===----------------------------------------------------------------------===// @@ -30,7 +30,7 @@ enum Encoding { Encoding_Unknown // We treat all other encodings as 8-bit encodings. }; -/// \brief Detects encoding of the Text. If the Text can be decoded using UTF-8, +/// Detects encoding of the Text. If the Text can be decoded using UTF-8, /// it is considered UTF8, otherwise we treat it as some 8-bit encoding. inline Encoding detectEncoding(StringRef Text) { const llvm::UTF8 *Ptr = reinterpret_cast<const llvm::UTF8 *>(Text.begin()); @@ -40,7 +40,7 @@ inline Encoding detectEncoding(StringRef Text) { return Encoding_Unknown; } -/// \brief Returns the number of columns required to display the \p Text on a +/// Returns the number of columns required to display the \p Text on a /// generic Unicode-capable terminal. Text is assumed to use the specified /// \p Encoding. inline unsigned columnWidth(StringRef Text, Encoding Encoding) { @@ -56,7 +56,7 @@ inline unsigned columnWidth(StringRef Text, Encoding Encoding) { return Text.size(); } -/// \brief Returns the number of columns required to display the \p Text, +/// Returns the number of columns required to display the \p Text, /// starting from the \p StartColumn on a terminal with the \p TabWidth. The /// text is assumed to use the specified \p Encoding. inline unsigned columnWidthWithTabs(StringRef Text, unsigned StartColumn, @@ -73,7 +73,7 @@ inline unsigned columnWidthWithTabs(StringRef Text, unsigned StartColumn, } } -/// \brief Gets the number of bytes in a sequence representing a single +/// Gets the number of bytes in a sequence representing a single /// codepoint and starting with FirstChar in the specified Encoding. inline unsigned getCodePointNumBytes(char FirstChar, Encoding Encoding) { switch (Encoding) { @@ -91,7 +91,7 @@ inline bool isHexDigit(char c) { ('A' <= c && c <= 'F'); } -/// \brief Gets the length of an escape sequence inside a C++ string literal. +/// Gets the length of an escape sequence inside a C++ string literal. /// Text should span from the beginning of the escape sequence (starting with a /// backslash) to the end of the string literal. inline unsigned getEscapeSequenceLength(StringRef Text) { diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index aaca6d2cef7..a2a1c7addec 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements functions declared in Format.h. This will be +/// This file implements functions declared in Format.h. This will be /// split into separate files as we go. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/FormatInternal.h b/clang/lib/Format/FormatInternal.h index 3984158467b..5c59e7656ee 100644 --- a/clang/lib/Format/FormatInternal.h +++ b/clang/lib/Format/FormatInternal.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares Format APIs to be used internally by the +/// This file declares Format APIs to be used internally by the /// formatting library implementation. /// //===----------------------------------------------------------------------===// @@ -24,7 +24,7 @@ namespace clang { namespace format { namespace internal { -/// \brief Reformats the given \p Ranges in the code fragment \p Code. +/// Reformats the given \p Ranges in the code fragment \p Code. /// /// A fragment of code could conceptually be surrounded by other code that might /// constrain how that fragment is laid out. diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index c63f0129c48..62b08c576e0 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements specific functions of \c FormatTokens and their +/// This file implements specific functions of \c FormatTokens and their /// roles. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index a1e8ecbd72f..7d13d09da79 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file contains the declaration of the FormatToken, a wrapper +/// This file contains the declaration of the FormatToken, a wrapper /// around Token with additional information related to formatting. /// //===----------------------------------------------------------------------===// @@ -104,7 +104,7 @@ enum TokenType { NUM_TOKEN_TYPES }; -/// \brief Determines the name of a token type. +/// Determines the name of a token type. const char *getTokenTypeName(TokenType Type); // Represents what type of block a set of braces open. @@ -118,185 +118,185 @@ enum FormatDecision { FD_Unformatted, FD_Continue, FD_Break }; class TokenRole; class AnnotatedLine; -/// \brief A wrapper around a \c Token storing information about the +/// A wrapper around a \c Token storing information about the /// whitespace characters preceding it. struct FormatToken { FormatToken() {} - /// \brief The \c Token. + /// The \c Token. Token Tok; - /// \brief The number of newlines immediately before the \c Token. + /// The number of newlines immediately before the \c Token. /// /// This can be used to determine what the user wrote in the original code /// and thereby e.g. leave an empty line between two function definitions. unsigned NewlinesBefore = 0; - /// \brief Whether there is at least one unescaped newline before the \c + /// Whether there is at least one unescaped newline before the \c /// Token. bool HasUnescapedNewline = false; - /// \brief The range of the whitespace immediately preceding the \c Token. + /// The range of the whitespace immediately preceding the \c Token. SourceRange WhitespaceRange; - /// \brief The offset just past the last '\n' in this token's leading + /// The offset just past the last '\n' in this token's leading /// whitespace (relative to \c WhiteSpaceStart). 0 if there is no '\n'. unsigned LastNewlineOffset = 0; - /// \brief The width of the non-whitespace parts of the token (or its first + /// The width of the non-whitespace parts of the token (or its first /// line for multi-line tokens) in columns. /// We need this to correctly measure number of columns a token spans. unsigned ColumnWidth = 0; - /// \brief Contains the width in columns of the last line of a multi-line + /// Contains the width in columns of the last line of a multi-line /// token. unsigned LastLineColumnWidth = 0; - /// \brief Whether the token text contains newlines (escaped or not). + /// Whether the token text contains newlines (escaped or not). bool IsMultiline = false; - /// \brief Indicates that this is the first token of the file. + /// Indicates that this is the first token of the file. bool IsFirst = false; - /// \brief Whether there must be a line break before this token. + /// Whether there must be a line break before this token. /// /// This happens for example when a preprocessor directive ended directly /// before the token. bool MustBreakBefore = false; - /// \brief The raw text of the token. + /// The raw text of the token. /// /// Contains the raw token text without leading whitespace and without leading /// escaped newlines. StringRef TokenText; - /// \brief Set to \c true if this token is an unterminated literal. + /// Set to \c true if this token is an unterminated literal. bool IsUnterminatedLiteral = 0; - /// \brief Contains the kind of block if this token is a brace. + /// Contains the kind of block if this token is a brace. BraceBlockKind BlockKind = BK_Unknown; TokenType Type = TT_Unknown; - /// \brief The number of spaces that should be inserted before this token. + /// The number of spaces that should be inserted before this token. unsigned SpacesRequiredBefore = 0; - /// \brief \c true if it is allowed to break before this token. + /// \c true if it is allowed to break before this token. bool CanBreakBefore = false; - /// \brief \c true if this is the ">" of "template<..>". + /// \c true if this is the ">" of "template<..>". bool ClosesTemplateDeclaration = false; - /// \brief Number of parameters, if this is "(", "[" or "<". + /// Number of parameters, if this is "(", "[" or "<". /// /// This is initialized to 1 as we don't need to distinguish functions with /// 0 parameters from functions with 1 parameter. Thus, we can simply count /// the number of commas. unsigned ParameterCount = 0; - /// \brief Number of parameters that are nested blocks, + /// Number of parameters that are nested blocks, /// if this is "(", "[" or "<". unsigned BlockParameterCount = 0; - /// \brief If this is a bracket ("<", "(", "[" or "{"), contains the kind of + /// If this is a bracket ("<", "(", "[" or "{"), contains the kind of /// the surrounding bracket. tok::TokenKind ParentBracket = tok::unknown; - /// \brief A token can have a special role that can carry extra information + /// A token can have a special role that can carry extra information /// about the token's formatting. std::unique_ptr<TokenRole> Role; - /// \brief If this is an opening parenthesis, how are the parameters packed? + /// If this is an opening parenthesis, how are the parameters packed? ParameterPackingKind PackingKind = PPK_Inconclusive; - /// \brief The total length of the unwrapped line up to and including this + /// The total length of the unwrapped line up to and including this /// token. unsigned TotalLength = 0; - /// \brief The original 0-based column of this token, including expanded tabs. + /// The original 0-based column of this token, including expanded tabs. /// The configured TabWidth is used as tab width. unsigned OriginalColumn = 0; - /// \brief The length of following tokens until the next natural split point, + /// The length of following tokens until the next natural split point, /// or the next token that can be broken. unsigned UnbreakableTailLength = 0; // FIXME: Come up with a 'cleaner' concept. - /// \brief The binding strength of a token. This is a combined value of + /// The binding strength of a token. This is a combined value of /// operator precedence, parenthesis nesting, etc. unsigned BindingStrength = 0; - /// \brief The nesting level of this token, i.e. the number of surrounding (), + /// The nesting level of this token, i.e. the number of surrounding (), /// [], {} or <>. unsigned NestingLevel = 0; - /// \brief The indent level of this token. Copied from the surrounding line. + /// The indent level of this token. Copied from the surrounding line. unsigned IndentLevel = 0; - /// \brief Penalty for inserting a line break before this token. + /// Penalty for inserting a line break before this token. unsigned SplitPenalty = 0; - /// \brief If this is the first ObjC selector name in an ObjC method + /// If this is the first ObjC selector name in an ObjC method /// definition or call, this contains the length of the longest name. /// /// This being set to 0 means that the selectors should not be colon-aligned, /// e.g. because several of them are block-type. unsigned LongestObjCSelectorName = 0; - /// \brief How many parts ObjC selector have (i.e. how many parameters method + /// How many parts ObjC selector have (i.e. how many parameters method /// has). unsigned ObjCSelectorNameParts = 0; - /// \brief Stores the number of required fake parentheses and the + /// Stores the number of required fake parentheses and the /// corresponding operator precedence. /// /// If multiple fake parentheses start at a token, this vector stores them in /// reverse order, i.e. inner fake parenthesis first. SmallVector<prec::Level, 4> FakeLParens; - /// \brief Insert this many fake ) after this token for correct indentation. + /// Insert this many fake ) after this token for correct indentation. unsigned FakeRParens = 0; - /// \brief \c true if this token starts a binary expression, i.e. has at least + /// \c true if this token starts a binary expression, i.e. has at least /// one fake l_paren with a precedence greater than prec::Unknown. bool StartsBinaryExpression = false; - /// \brief \c true if this token ends a binary expression. + /// \c true if this token ends a binary expression. bool EndsBinaryExpression = false; - /// \brief Is this is an operator (or "."/"->") in a sequence of operators + /// Is this is an operator (or "."/"->") in a sequence of operators /// with the same precedence, contains the 0-based operator index. unsigned OperatorIndex = 0; - /// \brief If this is an operator (or "."/"->") in a sequence of operators + /// If this is an operator (or "."/"->") in a sequence of operators /// with the same precedence, points to the next operator. FormatToken *NextOperator = nullptr; - /// \brief Is this token part of a \c DeclStmt defining multiple variables? + /// Is this token part of a \c DeclStmt defining multiple variables? /// /// Only set if \c Type == \c TT_StartOfName. bool PartOfMultiVariableDeclStmt = false; - /// \brief Does this line comment continue a line comment section? + /// Does this line comment continue a line comment section? /// /// Only set to true if \c Type == \c TT_LineComment. bool ContinuesLineCommentSection = false; - /// \brief If this is a bracket, this points to the matching one. + /// If this is a bracket, this points to the matching one. FormatToken *MatchingParen = nullptr; - /// \brief The previous token in the unwrapped line. + /// The previous token in the unwrapped line. FormatToken *Previous = nullptr; - /// \brief The next token in the unwrapped line. + /// The next token in the unwrapped line. FormatToken *Next = nullptr; - /// \brief If this token starts a block, this contains all the unwrapped lines + /// If this token starts a block, this contains all the unwrapped lines /// in it. SmallVector<AnnotatedLine *, 1> Children; - /// \brief Stores the formatting decision for the token once it was made. + /// Stores the formatting decision for the token once it was made. FormatDecision Decision = FD_Unformatted; - /// \brief If \c true, this token has been fully formatted (indented and + /// If \c true, this token has been fully formatted (indented and /// potentially re-formatted inside), and we do not allow further formatting /// changes. bool Finalized = false; @@ -344,7 +344,7 @@ struct FormatToken { (!ColonRequired || (Next && Next->is(tok::colon))); } - /// \brief Determine whether the token is a simple-type-specifier. + /// Determine whether the token is a simple-type-specifier. bool isSimpleTypeSpecifier() const; bool isObjCAccessSpecifier() const { @@ -355,7 +355,7 @@ struct FormatToken { Next->isObjCAtKeyword(tok::objc_private)); } - /// \brief Returns whether \p Tok is ([{ or an opening < of a template or in + /// Returns whether \p Tok is ([{ or an opening < of a template or in /// protos. bool opensScope() const { if (is(TT_TemplateString) && TokenText.endswith("${")) @@ -365,7 +365,7 @@ struct FormatToken { return isOneOf(tok::l_paren, tok::l_brace, tok::l_square, TT_TemplateOpener); } - /// \brief Returns whether \p Tok is )]} or a closing > of a template or in + /// Returns whether \p Tok is )]} or a closing > of a template or in /// protos. bool closesScope() const { if (is(TT_TemplateString) && TokenText.startswith("}")) @@ -376,7 +376,7 @@ struct FormatToken { TT_TemplateCloser); } - /// \brief Returns \c true if this is a "." or "->" accessing a member. + /// Returns \c true if this is a "." or "->" accessing a member. bool isMemberAccess() const { return isOneOf(tok::arrow, tok::period, tok::arrowstar) && !isOneOf(TT_DesignatedInitializerPeriod, TT_TrailingReturnArrow, @@ -409,7 +409,7 @@ struct FormatToken { (is(TT_LineComment) || !Next || Next->NewlinesBefore > 0); } - /// \brief Returns \c true if this is a keyword that can be used + /// Returns \c true if this is a keyword that can be used /// like a function call (e.g. sizeof, typeid, ...). bool isFunctionLikeKeyword() const { switch (Tok.getKind()) { @@ -429,7 +429,7 @@ struct FormatToken { } } - /// \brief Returns \c true if this is a string literal that's like a label, + /// Returns \c true if this is a string literal that's like a label, /// e.g. ends with "=" or ":". bool isLabelString() const { if (!is(tok::string_literal)) @@ -444,7 +444,7 @@ struct FormatToken { (Content.back() == ':' || Content.back() == '='); } - /// \brief Returns actual token start location without leading escaped + /// Returns actual token start location without leading escaped /// newlines and whitespace. /// /// This can be different to Tok.getLocation(), which includes leading escaped @@ -458,7 +458,7 @@ struct FormatToken { /*CPlusPlus11=*/true); } - /// \brief Returns the previous token ignoring comments. + /// Returns the previous token ignoring comments. FormatToken *getPreviousNonComment() const { FormatToken *Tok = Previous; while (Tok && Tok->is(tok::comment)) @@ -466,7 +466,7 @@ struct FormatToken { return Tok; } - /// \brief Returns the next token ignoring comments. + /// Returns the next token ignoring comments. const FormatToken *getNextNonComment() const { const FormatToken *Tok = Next; while (Tok && Tok->is(tok::comment)) @@ -474,7 +474,7 @@ struct FormatToken { return Tok; } - /// \brief Returns \c true if this tokens starts a block-type list, i.e. a + /// Returns \c true if this tokens starts a block-type list, i.e. a /// list that should be indented with a block indent. bool opensBlockOrBlockTypeList(const FormatStyle &Style) const { if (is(TT_TemplateString) && opensScope()) @@ -488,7 +488,7 @@ struct FormatToken { Style.Language == FormatStyle::LK_TextProto)); } - /// \brief Returns whether the token is the left square bracket of a C++ + /// Returns whether the token is the left square bracket of a C++ /// structured binding declaration. bool isCppStructuredBinding(const FormatStyle &Style) const { if (!Style.isCpp() || isNot(tok::l_square)) @@ -501,14 +501,14 @@ struct FormatToken { return T && T->is(tok::kw_auto); } - /// \brief Same as opensBlockOrBlockTypeList, but for the closing token. + /// Same as opensBlockOrBlockTypeList, but for the closing token. bool closesBlockOrBlockTypeList(const FormatStyle &Style) const { if (is(TT_TemplateString) && closesScope()) return true; return MatchingParen && MatchingParen->opensBlockOrBlockTypeList(Style); } - /// \brief Return the actual namespace token, if this token starts a namespace + /// Return the actual namespace token, if this token starts a namespace /// block. const FormatToken *getNamespaceToken() const { const FormatToken *NamespaceTok = this; @@ -561,11 +561,11 @@ public: TokenRole(const FormatStyle &Style) : Style(Style) {} virtual ~TokenRole(); - /// \brief After the \c TokenAnnotator has finished annotating all the tokens, + /// After the \c TokenAnnotator has finished annotating all the tokens, /// this function precomputes required information for formatting. virtual void precomputeFormattingInfos(const FormatToken *Token); - /// \brief Apply the special formatting that the given role demands. + /// Apply the special formatting that the given role demands. /// /// Assumes that the token having this role is already formatted. /// @@ -577,7 +577,7 @@ public: return 0; } - /// \brief Same as \c formatFromToken, but assumes that the first token has + /// Same as \c formatFromToken, but assumes that the first token has /// already been set thereby deciding on the first line break. virtual unsigned formatAfterToken(LineState &State, ContinuationIndenter *Indenter, @@ -585,7 +585,7 @@ public: return 0; } - /// \brief Notifies the \c Role that a comma was found. + /// Notifies the \c Role that a comma was found. virtual void CommaFound(const FormatToken *Token) {} protected: @@ -605,46 +605,46 @@ public: unsigned formatFromToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun) override; - /// \brief Adds \p Token as the next comma to the \c CommaSeparated list. + /// Adds \p Token as the next comma to the \c CommaSeparated list. void CommaFound(const FormatToken *Token) override { Commas.push_back(Token); } private: - /// \brief A struct that holds information on how to format a given list with + /// A struct that holds information on how to format a given list with /// a specific number of columns. struct ColumnFormat { - /// \brief The number of columns to use. + /// The number of columns to use. unsigned Columns; - /// \brief The total width in characters. + /// The total width in characters. unsigned TotalWidth; - /// \brief The number of lines required for this format. + /// The number of lines required for this format. unsigned LineCount; - /// \brief The size of each column in characters. + /// The size of each column in characters. SmallVector<unsigned, 8> ColumnSizes; }; - /// \brief Calculate which \c ColumnFormat fits best into + /// Calculate which \c ColumnFormat fits best into /// \p RemainingCharacters. const ColumnFormat *getColumnFormat(unsigned RemainingCharacters) const; - /// \brief The ordered \c FormatTokens making up the commas of this list. + /// The ordered \c FormatTokens making up the commas of this list. SmallVector<const FormatToken *, 8> Commas; - /// \brief The length of each of the list's items in characters including the + /// The length of each of the list's items in characters including the /// trailing comma. SmallVector<unsigned, 8> ItemLengths; - /// \brief Precomputed formats that can be used for this list. + /// Precomputed formats that can be used for this list. SmallVector<ColumnFormat, 4> Formats; bool HasNestedBracedList; }; -/// \brief Encapsulates keywords that are context sensitive or for languages not +/// Encapsulates keywords that are context sensitive or for languages not /// properly supported by Clang's lexer. struct AdditionalKeywords { AdditionalKeywords(IdentifierTable &IdentTable) { @@ -776,7 +776,7 @@ struct AdditionalKeywords { IdentifierInfo *kw_slots; IdentifierInfo *kw_qslots; - /// \brief Returns \c true if \p Tok is a true JavaScript identifier, returns + /// Returns \c true if \p Tok is a true JavaScript identifier, returns /// \c false if it is a keyword or a pseudo keyword. bool IsJavaScriptIdentifier(const FormatToken &Tok) const { return Tok.is(tok::identifier) && @@ -785,7 +785,7 @@ struct AdditionalKeywords { } private: - /// \brief The JavaScript keywords beyond the C++ keyword set. + /// The JavaScript keywords beyond the C++ keyword set. std::unordered_set<IdentifierInfo *> JsExtraKeywords; }; diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index e06e26f8bc1..fbd26965a6e 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements FormatTokenLexer, which tokenizes a source file +/// This file implements FormatTokenLexer, which tokenizes a source file /// into a FormatToken stream suitable for ClangFormat. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 59dc2a752f1..3b79d27480e 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file contains FormatTokenLexer, which tokenizes a source file +/// This file contains FormatTokenLexer, which tokenizes a source file /// into a token stream suitable for ClangFormat. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp index ea369a769fb..995b3219a1f 100644 --- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp +++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements NamespaceEndCommentsFixer, a TokenAnalyzer that +/// This file implements NamespaceEndCommentsFixer, a TokenAnalyzer that /// fixes namespace end comments. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.h b/clang/lib/Format/NamespaceEndCommentsFixer.h index adfe38943c8..07a1c7bb0c3 100644 --- a/clang/lib/Format/NamespaceEndCommentsFixer.h +++ b/clang/lib/Format/NamespaceEndCommentsFixer.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares NamespaceEndCommentsFixer, a TokenAnalyzer that +/// This file declares NamespaceEndCommentsFixer, a TokenAnalyzer that /// fixes namespace end comments. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp index b598a26f8cc..0ca2c4433ca 100644 --- a/clang/lib/Format/SortJavaScriptImports.cpp +++ b/clang/lib/Format/SortJavaScriptImports.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements a sort operation for JavaScript ES6 imports. +/// This file implements a sort operation for JavaScript ES6 imports. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/SortJavaScriptImports.h b/clang/lib/Format/SortJavaScriptImports.h index f22a051008f..ecab0ae54cb 100644 --- a/clang/lib/Format/SortJavaScriptImports.h +++ b/clang/lib/Format/SortJavaScriptImports.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements a sorter for JavaScript ES6 imports. +/// This file implements a sorter for JavaScript ES6 imports. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/TokenAnalyzer.cpp b/clang/lib/Format/TokenAnalyzer.cpp index d1dfb1fea32..806a5961794 100644 --- a/clang/lib/Format/TokenAnalyzer.cpp +++ b/clang/lib/Format/TokenAnalyzer.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements an abstract TokenAnalyzer and associated helper +/// This file implements an abstract TokenAnalyzer and associated helper /// classes. TokenAnalyzer can be extended to generate replacements based on /// an annotated and pre-processed token stream. /// diff --git a/clang/lib/Format/TokenAnalyzer.h b/clang/lib/Format/TokenAnalyzer.h index 96ea00b25ba..a8978b56cb4 100644 --- a/clang/lib/Format/TokenAnalyzer.h +++ b/clang/lib/Format/TokenAnalyzer.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares an abstract TokenAnalyzer, and associated helper +/// This file declares an abstract TokenAnalyzer, and associated helper /// classes. TokenAnalyzer can be extended to generate replacements based on /// an annotated and pre-processed token stream. /// diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 475eadd9f4c..ef763319d00 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements a token annotator, i.e. creates +/// This file implements a token annotator, i.e. creates /// \c AnnotatedTokens out of \c FormatTokens with required extra information. /// //===----------------------------------------------------------------------===// @@ -25,7 +25,7 @@ namespace format { namespace { -/// \brief Returns \c true if the token can be used as an identifier in +/// Returns \c true if the token can be used as an identifier in /// an Objective-C \c @selector, \c false otherwise. /// /// Because getFormattingLangOpts() always lexes source code as @@ -40,7 +40,7 @@ static bool canBeObjCSelectorComponent(const FormatToken &Tok) { return Tok.Tok.getIdentifierInfo() != nullptr; } -/// \brief A parser that gathers additional information about tokens. +/// A parser that gathers additional information about tokens. /// /// The \c TokenAnnotator tries to match parenthesis and square brakets and /// store a parenthesis levels. It also tries to resolve matching "<" and ">" @@ -1132,7 +1132,7 @@ private: resetTokenMetadata(CurrentToken); } - /// \brief A struct to hold information valid in a specific context, e.g. + /// A struct to hold information valid in a specific context, e.g. /// a pair of parenthesis. struct Context { Context(tok::TokenKind ContextKind, unsigned BindingStrength, @@ -1158,7 +1158,7 @@ private: bool InCpp11AttributeSpecifier = false; }; - /// \brief Puts a new \c Context onto the stack \c Contexts for the lifetime + /// Puts a new \c Context onto the stack \c Contexts for the lifetime /// of each instance. struct ScopedContextCreator { AnnotatingParser &P; @@ -1399,7 +1399,7 @@ private: } } - /// \brief Take a guess at whether \p Tok starts a name of a function or + /// Take a guess at whether \p Tok starts a name of a function or /// variable declaration. /// /// This is a heuristic based on whether \p Tok is an identifier following @@ -1444,7 +1444,7 @@ private: PreviousNotConst->isSimpleTypeSpecifier(); } - /// \brief Determine whether ')' is ending a cast. + /// Determine whether ')' is ending a cast. bool rParenEndsCast(const FormatToken &Tok) { // C-style casts are only used in C++ and Java. if (!Style.isCpp() && Style.Language != FormatStyle::LK_Java) @@ -1541,7 +1541,7 @@ private: return true; } - /// \brief Return the type of the given token assuming it is * or &. + /// Return the type of the given token assuming it is * or &. TokenType determineStarAmpUsage(const FormatToken &Tok, bool IsExpression, bool InTemplateArgument) { if (Style.Language == FormatStyle::LK_JavaScript) @@ -1636,7 +1636,7 @@ private: return TT_BinaryOperator; } - /// \brief Determine whether ++/-- are pre- or post-increments/-decrements. + /// Determine whether ++/-- are pre- or post-increments/-decrements. TokenType determineIncrementUsage(const FormatToken &Tok) { const FormatToken *PrevToken = Tok.getPreviousNonComment(); if (!PrevToken || PrevToken->is(TT_CastRParen)) @@ -1665,7 +1665,7 @@ private: static const int PrecedenceUnaryOperator = prec::PointerToMember + 1; static const int PrecedenceArrowAndPeriod = prec::PointerToMember + 2; -/// \brief Parses binary expressions by inserting fake parenthesis based on +/// Parses binary expressions by inserting fake parenthesis based on /// operator precedence. class ExpressionParser { public: @@ -1673,7 +1673,7 @@ public: AnnotatedLine &Line) : Style(Style), Keywords(Keywords), Current(Line.First) {} - /// \brief Parse expressions with the given operator precedence. + /// Parse expressions with the given operator precedence. void parse(int Precedence = 0) { // Skip 'return' and ObjC selector colons as they are not part of a binary // expression. @@ -1760,7 +1760,7 @@ public: } private: - /// \brief Gets the precedence (+1) of the given token for binary operators + /// Gets the precedence (+1) of the given token for binary operators /// and other tokens that we treat like binary operators. int getCurrentPrecedence() { if (Current) { @@ -1819,7 +1819,7 @@ private: } } - /// \brief Parse unary operator expressions and surround them with fake + /// Parse unary operator expressions and surround them with fake /// parentheses if appropriate. void parseUnaryOperator() { llvm::SmallVector<FormatToken *, 2> Tokens; diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h index 15b9ae64629..a3124fcb3d6 100644 --- a/clang/lib/Format/TokenAnnotator.h +++ b/clang/lib/Format/TokenAnnotator.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements a token annotator, i.e. creates +/// This file implements a token annotator, i.e. creates /// \c AnnotatedTokens out of \c FormatTokens with required extra information. /// //===----------------------------------------------------------------------===// @@ -138,14 +138,14 @@ private: void operator=(const AnnotatedLine &) = delete; }; -/// \brief Determines extra information about the tokens comprising an +/// Determines extra information about the tokens comprising an /// \c UnwrappedLine. class TokenAnnotator { public: TokenAnnotator(const FormatStyle &Style, const AdditionalKeywords &Keywords) : Style(Style), Keywords(Keywords) {} - /// \brief Adapts the indent levels of comment lines to the indent of the + /// Adapts the indent levels of comment lines to the indent of the /// subsequent line. // FIXME: Can/should this be done in the UnwrappedLineParser? void setCommentLineLevels(SmallVectorImpl<AnnotatedLine *> &Lines); @@ -154,7 +154,7 @@ public: void calculateFormattingInformation(AnnotatedLine &Line); private: - /// \brief Calculate the penalty for splitting before \c Tok. + /// Calculate the penalty for splitting before \c Tok. unsigned splitPenalty(const AnnotatedLine &Line, const FormatToken &Tok, bool InFunctionDecl); diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 45ddc1cc638..337a6622750 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -27,7 +27,7 @@ bool startsExternCBlock(const AnnotatedLine &Line) { NextNext && NextNext->is(tok::l_brace); } -/// \brief Tracks the indent level of \c AnnotatedLines across levels. +/// Tracks the indent level of \c AnnotatedLines across levels. /// /// \c nextLine must be called for each \c AnnotatedLine, after which \c /// getIndent() will return the indent for the last line \c nextLine was called @@ -46,10 +46,10 @@ public: IndentForLevel.push_back(Style.IndentWidth * i + AdditionalIndent); } - /// \brief Returns the indent for the current line. + /// Returns the indent for the current line. unsigned getIndent() const { return Indent; } - /// \brief Update the indent state given that \p Line is going to be formatted + /// Update the indent state given that \p Line is going to be formatted /// next. void nextLine(const AnnotatedLine &Line) { Offset = getIndentOffset(*Line.First); @@ -67,14 +67,14 @@ public: Indent += Offset; } - /// \brief Update the indent state given that \p Line indent should be + /// Update the indent state given that \p Line indent should be /// skipped. void skipLine(const AnnotatedLine &Line) { while (IndentForLevel.size() <= Line.Level) IndentForLevel.push_back(Indent); } - /// \brief Update the level indent to adapt to the given \p Line. + /// Update the level indent to adapt to the given \p Line. /// /// When a line is not formatted, we move the subsequent lines on the same /// level to the same indent. @@ -89,7 +89,7 @@ public: } private: - /// \brief Get the offset of the line relatively to the level. + /// Get the offset of the line relatively to the level. /// /// For example, 'public:' labels in classes are offset by 1 or 2 /// characters to the left from their level. @@ -105,7 +105,7 @@ private: return 0; } - /// \brief Get the indent of \p Level from \p IndentForLevel. + /// Get the indent of \p Level from \p IndentForLevel. /// /// \p IndentForLevel must contain the indent for the level \c l /// at \p IndentForLevel[l], or a value < 0 if the indent for @@ -122,16 +122,16 @@ private: const AdditionalKeywords &Keywords; const unsigned AdditionalIndent; - /// \brief The indent in characters for each level. + /// The indent in characters for each level. std::vector<int> IndentForLevel; - /// \brief Offset of the current line relative to the indent level. + /// Offset of the current line relative to the indent level. /// /// For example, the 'public' keywords is often indented with a negative /// offset. int Offset = 0; - /// \brief The current line's indent. + /// The current line's indent. unsigned Indent = 0; }; @@ -158,7 +158,7 @@ public: : Style(Style), Keywords(Keywords), End(Lines.end()), Next(Lines.begin()), AnnotatedLines(Lines) {} - /// \brief Returns the next line, merging multiple lines into one if possible. + /// Returns the next line, merging multiple lines into one if possible. const AnnotatedLine *getNextMergedLine(bool DryRun, LevelIndentTracker &IndentTracker) { if (Next == End) @@ -180,7 +180,7 @@ public: } private: - /// \brief Calculates how many lines can be merged into 1 starting at \p I. + /// Calculates how many lines can be merged into 1 starting at \p I. unsigned tryFitMultipleLinesInOne(LevelIndentTracker &IndentTracker, SmallVectorImpl<AnnotatedLine *>::const_iterator I, @@ -666,7 +666,7 @@ static void printLineState(const LineState &State) { } #endif -/// \brief Base class for classes that format one \c AnnotatedLine. +/// Base class for classes that format one \c AnnotatedLine. class LineFormatter { public: LineFormatter(ContinuationIndenter *Indenter, WhitespaceManager *Whitespaces, @@ -676,7 +676,7 @@ public: BlockFormatter(BlockFormatter) {} virtual ~LineFormatter() {} - /// \brief Formats an \c AnnotatedLine and returns the penalty. + /// Formats an \c AnnotatedLine and returns the penalty. /// /// If \p DryRun is \c false, directly applies the changes. virtual unsigned formatLine(const AnnotatedLine &Line, @@ -685,7 +685,7 @@ public: bool DryRun) = 0; protected: - /// \brief If the \p State's next token is an r_brace closing a nested block, + /// If the \p State's next token is an r_brace closing a nested block, /// format the nested block before it. /// /// Returns \c true if all children could be placed successfully and adapts @@ -767,7 +767,7 @@ private: UnwrappedLineFormatter *BlockFormatter; }; -/// \brief Formatter that keeps the existing line breaks. +/// Formatter that keeps the existing line breaks. class NoColumnLimitLineFormatter : public LineFormatter { public: NoColumnLimitLineFormatter(ContinuationIndenter *Indenter, @@ -776,7 +776,7 @@ public: UnwrappedLineFormatter *BlockFormatter) : LineFormatter(Indenter, Whitespaces, Style, BlockFormatter) {} - /// \brief Formats the line, simply keeping all of the input's line breaking + /// Formats the line, simply keeping all of the input's line breaking /// decisions. unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, unsigned FirstStartColumn, bool DryRun) override { @@ -795,7 +795,7 @@ public: } }; -/// \brief Formatter that puts all tokens into a single line without breaks. +/// Formatter that puts all tokens into a single line without breaks. class NoLineBreakFormatter : public LineFormatter { public: NoLineBreakFormatter(ContinuationIndenter *Indenter, @@ -803,7 +803,7 @@ public: UnwrappedLineFormatter *BlockFormatter) : LineFormatter(Indenter, Whitespaces, Style, BlockFormatter) {} - /// \brief Puts all tokens into a single line. + /// Puts all tokens into a single line. unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, unsigned FirstStartColumn, bool DryRun) override { unsigned Penalty = 0; @@ -818,7 +818,7 @@ public: } }; -/// \brief Finds the best way to break lines. +/// Finds the best way to break lines. class OptimizingLineFormatter : public LineFormatter { public: OptimizingLineFormatter(ContinuationIndenter *Indenter, @@ -827,7 +827,7 @@ public: UnwrappedLineFormatter *BlockFormatter) : LineFormatter(Indenter, Whitespaces, Style, BlockFormatter) {} - /// \brief Formats the line by finding the best line breaks with line lengths + /// Formats the line by finding the best line breaks with line lengths /// below the column limit. unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, unsigned FirstStartColumn, bool DryRun) override { @@ -850,14 +850,14 @@ private: } }; - /// \brief A pair of <penalty, count> that is used to prioritize the BFS on. + /// A pair of <penalty, count> that is used to prioritize the BFS on. /// /// In case of equal penalties, we want to prefer states that were inserted /// first. During state generation we make sure that we insert states first /// that break the line as late as possible. typedef std::pair<unsigned, unsigned> OrderedPenalty; - /// \brief An edge in the solution space from \c Previous->State to \c State, + /// An edge in the solution space from \c Previous->State to \c State, /// inserting a newline dependent on the \c NewLine. struct StateNode { StateNode(const LineState &State, bool NewLine, StateNode *Previous) @@ -867,16 +867,16 @@ private: StateNode *Previous; }; - /// \brief An item in the prioritized BFS search queue. The \c StateNode's + /// An item in the prioritized BFS search queue. The \c StateNode's /// \c State has the given \c OrderedPenalty. typedef std::pair<OrderedPenalty, StateNode *> QueueItem; - /// \brief The BFS queue type. + /// The BFS queue type. typedef std::priority_queue<QueueItem, std::vector<QueueItem>, std::greater<QueueItem>> QueueType; - /// \brief Analyze the entire solution space starting from \p InitialState. + /// Analyze the entire solution space starting from \p InitialState. /// /// This implements a variant of Dijkstra's algorithm on the graph that spans /// the solution space (\c LineStates are the nodes). The algorithm tries to @@ -943,7 +943,7 @@ private: return Penalty; } - /// \brief Add the following state to the analysis queue \c Queue. + /// Add the following state to the analysis queue \c Queue. /// /// Assume the current state is \p PreviousNode and has been reached with a /// penalty of \p Penalty. Insert a line break if \p NewLine is \c true. @@ -965,7 +965,7 @@ private: ++(*Count); } - /// \brief Applies the best formatting by reconstructing the path in the + /// Applies the best formatting by reconstructing the path in the /// solution space that leads to \c Best. void reconstructPath(LineState &State, StateNode *Best) { std::deque<StateNode *> Path; diff --git a/clang/lib/Format/UnwrappedLineFormatter.h b/clang/lib/Format/UnwrappedLineFormatter.h index 756d99d6409..dac210ea62b 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.h +++ b/clang/lib/Format/UnwrappedLineFormatter.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief Implements a combinartorial exploration of all the different +/// Implements a combinartorial exploration of all the different /// linebreaks unwrapped lines can be formatted in. /// //===----------------------------------------------------------------------===// @@ -37,7 +37,7 @@ public: : Indenter(Indenter), Whitespaces(Whitespaces), Style(Style), Keywords(Keywords), SourceMgr(SourceMgr), Status(Status) {} - /// \brief Format the current block and return the penalty. + /// Format the current block and return the penalty. unsigned format(const SmallVectorImpl<AnnotatedLine *> &Lines, bool DryRun = false, int AdditionalIndent = 0, bool FixBadIndentation = false, @@ -46,14 +46,14 @@ public: unsigned LastStartColumn = 0); private: - /// \brief Add a new line and the required indent before the first Token + /// Add a new line and the required indent before the first Token /// of the \c UnwrappedLine if there was no structural parsing error. void formatFirstToken(const AnnotatedLine &Line, const AnnotatedLine *PreviousLine, const SmallVectorImpl<AnnotatedLine *> &Lines, unsigned Indent, unsigned NewlineIndent); - /// \brief Returns the column limit for a line, taking into account whether we + /// Returns the column limit for a line, taking into account whether we /// need an escaped newline due to a continued preprocessor directive. unsigned getColumnLimit(bool InPPDirective, const AnnotatedLine *NextLine) const; diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index b5bc80ba095..c4d92d42d82 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file contains the implementation of the UnwrappedLineParser, +/// This file contains the implementation of the UnwrappedLineParser, /// which turns a stream of tokens into UnwrappedLines. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h index da7529c2ade..9a171362805 100644 --- a/clang/lib/Format/UnwrappedLineParser.h +++ b/clang/lib/Format/UnwrappedLineParser.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file contains the declaration of the UnwrappedLineParser, +/// This file contains the declaration of the UnwrappedLineParser, /// which turns a stream of tokens into UnwrappedLines. /// //===----------------------------------------------------------------------===// @@ -28,7 +28,7 @@ namespace format { struct UnwrappedLineNode; -/// \brief An unwrapped line is a sequence of \c Token, that we would like to +/// An unwrapped line is a sequence of \c Token, that we would like to /// put on a single line if there was no column limit. /// /// This is used as a main interface between the \c UnwrappedLineParser and the @@ -38,24 +38,24 @@ struct UnwrappedLine { UnwrappedLine(); // FIXME: Don't use std::list here. - /// \brief The \c Tokens comprising this \c UnwrappedLine. + /// The \c Tokens comprising this \c UnwrappedLine. std::list<UnwrappedLineNode> Tokens; - /// \brief The indent level of the \c UnwrappedLine. + /// The indent level of the \c UnwrappedLine. unsigned Level; - /// \brief Whether this \c UnwrappedLine is part of a preprocessor directive. + /// Whether this \c UnwrappedLine is part of a preprocessor directive. bool InPPDirective; bool MustBeDeclaration; - /// \brief If this \c UnwrappedLine closes a block in a sequence of lines, + /// If this \c UnwrappedLine closes a block in a sequence of lines, /// \c MatchingOpeningBlockLineIndex stores the index of the corresponding /// opening line. Otherwise, \c MatchingOpeningBlockLineIndex must be /// \c kInvalidIndex. size_t MatchingOpeningBlockLineIndex = kInvalidIndex; - /// \brief If this \c UnwrappedLine opens a block, stores the index of the + /// If this \c UnwrappedLine opens a block, stores the index of the /// line with the corresponding closing brace. size_t MatchingClosingBlockLineIndex = kInvalidIndex; diff --git a/clang/lib/Format/UsingDeclarationsSorter.cpp b/clang/lib/Format/UsingDeclarationsSorter.cpp index d7ab4f31d27..a380f28f386 100644 --- a/clang/lib/Format/UsingDeclarationsSorter.cpp +++ b/clang/lib/Format/UsingDeclarationsSorter.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements UsingDeclarationsSorter, a TokenAnalyzer that +/// This file implements UsingDeclarationsSorter, a TokenAnalyzer that /// sorts consecutive using declarations. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/UsingDeclarationsSorter.h b/clang/lib/Format/UsingDeclarationsSorter.h index 6f137712d84..7e5cf7610d6 100644 --- a/clang/lib/Format/UsingDeclarationsSorter.h +++ b/clang/lib/Format/UsingDeclarationsSorter.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares UsingDeclarationsSorter, a TokenAnalyzer that +/// This file declares UsingDeclarationsSorter, a TokenAnalyzer that /// sorts consecutive using declarations. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index 5c54080dd0d..7070ce03c86 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements WhitespaceManager class. +/// This file implements WhitespaceManager class. /// //===----------------------------------------------------------------------===// diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h index af20dc5616a..db90343f729 100644 --- a/clang/lib/Format/WhitespaceManager.h +++ b/clang/lib/Format/WhitespaceManager.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief WhitespaceManager class manages whitespace around tokens and their +/// WhitespaceManager class manages whitespace around tokens and their /// replacements. /// //===----------------------------------------------------------------------===// @@ -24,7 +24,7 @@ namespace clang { namespace format { -/// \brief Manages the whitespaces around tokens and their replacements. +/// Manages the whitespaces around tokens and their replacements. /// /// This includes special handling for certain constructs, e.g. the alignment of /// trailing line comments. @@ -41,7 +41,7 @@ public: bool UseCRLF) : SourceMgr(SourceMgr), Style(Style), UseCRLF(UseCRLF) {} - /// \brief Replaces the whitespace in front of \p Tok. Only call once for + /// Replaces the whitespace in front of \p Tok. Only call once for /// each \c AnnotatedToken. /// /// \p StartOfTokenColumn is the column at which the token will start after @@ -51,7 +51,7 @@ public: unsigned StartOfTokenColumn, bool InPPDirective = false); - /// \brief Adds information about an unchangeable token's whitespace. + /// Adds information about an unchangeable token's whitespace. /// /// Needs to be called for every token for which \c replaceWhitespace /// was not called. @@ -59,7 +59,7 @@ public: llvm::Error addReplacement(const tooling::Replacement &Replacement); - /// \brief Inserts or replaces whitespace in the middle of a token. + /// Inserts or replaces whitespace in the middle of a token. /// /// Inserts \p PreviousPostfix, \p Newlines, \p Spaces and \p CurrentPrefix /// (in this order) at \p Offset inside \p Tok, replacing \p ReplaceChars @@ -79,13 +79,13 @@ public: StringRef CurrentPrefix, bool InPPDirective, unsigned Newlines, int Spaces); - /// \brief Returns all the \c Replacements created during formatting. + /// Returns all the \c Replacements created during formatting. const tooling::Replacements &generateReplacements(); - /// \brief Represents a change before a token, a break inside a token, + /// Represents a change before a token, a break inside a token, /// or the layout of an unchanged token (or whitespace within). struct Change { - /// \brief Functor to sort changes in original source order. + /// Functor to sort changes in original source order. class IsBeforeInFile { public: IsBeforeInFile(const SourceManager &SourceMgr) : SourceMgr(SourceMgr) {} @@ -95,7 +95,7 @@ public: const SourceManager &SourceMgr; }; - /// \brief Creates a \c Change. + /// Creates a \c Change. /// /// The generated \c Change will replace the characters at /// \p OriginalWhitespaceRange with a concatenation of @@ -165,35 +165,35 @@ public: }; private: - /// \brief Calculate \c IsTrailingComment, \c TokenLength for the last tokens + /// Calculate \c IsTrailingComment, \c TokenLength for the last tokens /// or token parts in a line and \c PreviousEndOfTokenColumn and /// \c EscapedNewlineColumn for the first tokens or token parts in a line. void calculateLineBreakInformation(); - /// \brief Align consecutive assignments over all \c Changes. + /// Align consecutive assignments over all \c Changes. void alignConsecutiveAssignments(); - /// \brief Align consecutive declarations over all \c Changes. + /// Align consecutive declarations over all \c Changes. void alignConsecutiveDeclarations(); - /// \brief Align trailing comments over all \c Changes. + /// Align trailing comments over all \c Changes. void alignTrailingComments(); - /// \brief Align trailing comments from change \p Start to change \p End at + /// Align trailing comments from change \p Start to change \p End at /// the specified \p Column. void alignTrailingComments(unsigned Start, unsigned End, unsigned Column); - /// \brief Align escaped newlines over all \c Changes. + /// Align escaped newlines over all \c Changes. void alignEscapedNewlines(); - /// \brief Align escaped newlines from change \p Start to change \p End at + /// Align escaped newlines from change \p Start to change \p End at /// the specified \p Column. void alignEscapedNewlines(unsigned Start, unsigned End, unsigned Column); - /// \brief Fill \c Replaces with the replacements for all effective changes. + /// Fill \c Replaces with the replacements for all effective changes. void generateChanges(); - /// \brief Stores \p Text as the replacement for the whitespace in \p Range. + /// Stores \p Text as the replacement for the whitespace in \p Range. void storeReplacement(SourceRange Range, StringRef Text); void appendNewlineText(std::string &Text, unsigned Newlines); void appendEscapedNewlineText(std::string &Text, unsigned Newlines, |