Issue 149971
Summary [clang-format] Lack of space after 'not' operator before parens since clang-format-20
Labels clang-format
Assignees
Reporter stroju
    Change #135035 seems to be messing with for formatting of `not` works.

When `SpaceAfterLogicalNot: true` on 19.1.7 where outpus was:

`
bool operator!=(const A& r) const { return not (*this == r); }
`

while version 20.1.7 formats it as 

`
bool operator!=(const A& r) const { return not(*this == r); }
`

`!` works as before, while `not` seems to treaded like symbol (function).

Is this intentional that `SpaceAfterLogicalNot` does not reflect aby changes to `not` operator?

If so, how can we control this behavior so we can keep space after `not`?

My configuration:

Specific to the directory where file is:

> Language: Cpp
> InsertBraces: true
> InsertNewlineAtEOF: true
> KeepEmptyLines:
> AtEndOfFile: false
>     AtStartOfBlock: false
>     AtStartOfFile: false
> LineEnding: LF
> SpaceAfterLogicalNot: true
> SpacesInParens: Never

Basic config:

> Language: Cpp
> AccessModifierOffset: -4
> AlignAfterOpenBracket: AlwaysBreak
> AlignConsecutiveAssignments: false
> AlignConsecutiveDeclarations: false
> AlignOperands: false
> AlignTrailingComments: false
> AlignEscapedNewlinesLeft: true
> AllowAllParametersOfDeclarationOnNextLine: false
> AllowShortBlocksOnASingleLine: false
> AllowShortCaseLabelsOnASingleLine: false
> AllowShortIfStatementsOnASingleLine: true
> AllowShortLoopsOnASingleLine: false
> AllowShortFunctionsOnASingleLine: Inline
> AlwaysBreakAfterDefinitionReturnType: None
> AlwaysBreakBeforeMultilineStrings: false
> AlwaysBreakTemplateDeclarations: true
> BinPackArguments: false
> BinPackParameters: false
> BreakBeforeBinaryOperators: None
> BreakBeforeTernaryOperators: true
> BreakConstructorInitializersBeforeComma: true
> BreakStringLiterals: true
> ConstructorInitializerAllOnOneLineOrOnePerLine: true
> ConstructorInitializerIndentWidth: 4
> ContinuationIndentWidth: 4
> Cpp11BracedListStyle: true
> DisableFormat: false
> FixNamespaceComments: true
> IncludeCategories:
>   - Regex:           '^<sys/'
>     Priority: 1
>   - Regex:           '^<'
>     Priority:        2
>   - Regex: '^"'
>     Priority:        3
> IndentCaseLabels: true
> KeepEmptyLinesAtTheStartOfBlocks: false
> MaxEmptyLinesToKeep: 1
> BraceWrapping:
>    AfterNamespace: false
>    AfterUnion: true
> NamespaceIndentation: None
> PenaltyReturnTypeOnItsOwnLine: 5000
> PointerAlignment: Left
> SortIncludes: true
> SpaceBeforeAssignmentOperators: true
> SpaceBeforeParens: ControlStatements
> SpaceInEmptyParentheses: false
> Standard: Cpp11
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to