Skip to content

[clang-format] EmptyLineAfterAccessModifier and EmptyLineBeforeAccessModifier for Qt-specific access modifiers #142008

Open
@EugeneZelenko

Description

@EugeneZelenko

Looks like EmptyLineAfterAccessModifier and EmptyLineBeforeAccessModifier are not applied to Qt-specific access modifiers: signals, public slots, protected slots and private slots.
Test file:

#include <string>

class Test
{
    Q_OBJECT

public:

    Test();

protected:

    void protected_method();

private:

    void private_method();

signals:

    void signal();

public slots:

    void public_slot();

protected slots:

    void protected_slot();

private slots:

    void private_slot();
};

I tried 19.1.1 and main (49d48c3)

Configuration:

BasedOnStyle: LLVM

AlignConsecutiveDeclarations:
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: false
AllowShortFunctionsOnASingleLine: Inline
BreakBeforeBraces: Allman
ColumnLimit: 100
IndentPPDirectives: AfterHash
IndentWidth: 4
LineEnding: LF
UseTab: Never

Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: AcrossEmptyLines
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: false
BinPackParameters: false
BreakConstructorInitializers: BeforeComma
BreakTemplateDeclarations: Yes
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: true
MaxEmptyLinesToKeep: 1
PackConstructorInitializers: Never
PointerAlignment: Left
SortUsingDeclarations: true
StatementMacros:
  - PyObject_HEAD
  - Q_OBJECT

Abandoned patch on Phabricator: https://reviews.llvm.org/D129845

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions