**QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14`
- Different ways to arrange const/volatile qualifiers.
+ Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
.. warning::
Possible values:
* ``QAS_Leave`` (in configuration: ``Leave``)
- Don't change specifiers/qualifier to either Left or Right alignment
- (default)
+ Don't change specifiers/qualifiers to either Left or Right alignment
+ (default).
.. code-block:: c++
const int *a;
* ``QAS_Left`` (in configuration: ``Left``)
- Change specifiers/qualifiers to be Left aligned.
+ Change specifiers/qualifiers to be left-aligned.
.. code-block:: c++
const int *a;
* ``QAS_Right`` (in configuration: ``Right``)
- Change specifiers/qualifiers to be Right aligned.
+ Change specifiers/qualifiers to be right-aligned.
.. code-block:: c++
int const *a;
* ``QAS_Custom`` (in configuration: ``Custom``)
- Change specifiers/qualifiers to be aligned based on QualfierOrder.
+ Change specifiers/qualifiers to be aligned based on ``QualifierOrder``.
With:
.. code-block:: yaml
- QualifierOrder: ['inline', 'static' , '<type>', 'const']
+ QualifierOrder: ['inline', 'static' , 'type', 'const']
.. code-block:: c++
**QualifierOrder** (``List of Strings``) :versionbadge:`clang-format 14`
- The Order in which the qualifiers appear.
- Order is a an array can contain any of the following
+ The order in which the qualifiers appear.
+ Order is an array that can contain any of the following:
* const
* inline
* type
Note: it MUST contain 'type'.
- Items to the left of type will be aligned in the order supplied.
- Items to the right of type will be aligned in the order supplied.
+ Items to the left of 'type' will be placed to the left of the type and aligned in the order supplied.
+ Items to the right of 'type' will be placed to the right of the type and aligned in the order supplied.
.. code-block:: yaml
/// \version 3.7
std::string CommentPragmas;
- /// Different const/volatile qualifier alignment styles.
+ /// Different specifiers and qualifiers alignment styles.
enum QualifierAlignmentStyle {
- /// Don't change specifiers/qualifier to either Left or Right alignment
- /// (default)
+ /// Don't change specifiers/qualifiers to either Left or Right alignment
+ /// (default).
/// \code
/// int const a;
/// const int *a;
/// \endcode
QAS_Leave,
- /// Change specifiers/qualifiers to be Left aligned.
+ /// Change specifiers/qualifiers to be left-aligned.
/// \code
/// const int a;
/// const int *a;
/// \endcode
QAS_Left,
- /// Change specifiers/qualifiers to be Right aligned.
+ /// Change specifiers/qualifiers to be right-aligned.
/// \code
/// int const a;
/// int const *a;
/// \endcode
QAS_Right,
- /// Change specifiers/qualifiers to be aligned based on QualfierOrder.
+ /// Change specifiers/qualifiers to be aligned based on ``QualifierOrder``.
/// With:
/// \code{.yaml}
- /// QualifierOrder: ['inline', 'static' , '<type>', 'const']
+ /// QualifierOrder: ['inline', 'static' , 'type', 'const']
/// \endcode
///
/// \code
QAS_Custom
};
- /// Different ways to arrange const/volatile qualifiers.
+ /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
/// \warning
/// ``QualifierAlignment`` COULD lead to incorrect code generation.
/// \endwarning
/// \version 14
QualifierAlignmentStyle QualifierAlignment;
- /// The Order in which the qualifiers appear.
- /// Order is a an array can contain any of the following
+ /// The order in which the qualifiers appear.
+ /// Order is an array that can contain any of the following:
///
/// * const
/// * inline
/// * type
///
/// Note: it MUST contain 'type'.
- /// Items to the left of type will be aligned in the order supplied.
- /// Items to the right of type will be aligned in the order supplied.
+ /// Items to the left of 'type' will be placed to the left of the type and aligned in the order supplied.
+ /// Items to the right of 'type' will be placed to the right of the type and aligned in the order supplied.
///
/// \code{.yaml}
/// QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
tok::TokenKind LeftRightQualifierAlignmentFixer::getTokenFromQualifier(
const std::string &Qualifier) {
- // don't let 'type' be an indentifier steal typeof token
+ // Don't let 'type' be an identifier, but steal typeof token.
return llvm::StringSwitch<tok::TokenKind>(Qualifier)
.Case("type", tok::kw_typeof)
.Case("const", tok::kw_const)
// Check whether parameter list can belong to a function declaration.
if (!Next || !Next->is(tok::l_paren) || !Next->MatchingParen)
return false;
- // If the lines ends with "{", this is likely an function definition.
+ // If the lines ends with "{", this is likely a function definition.
if (Line.Last->is(tok::l_brace))
return true;
if (Next->Next == Next->MatchingParen)
!Tok.isOneOf(TT_ObjCBlockLBrace, TT_LambdaLBrace, TT_DictLiteral);
}
-// Returns 'true' if 'Tok' is an function argument.
+// Returns 'true' if 'Tok' is a function argument.
static bool IsFunctionArgument(const FormatToken &Tok) {
return Tok.MatchingParen && Tok.MatchingParen->Next &&
Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren);