Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-format] Add flag to suppress empty line insertion before access modifier. #16892

Closed
silvasean opened this issue Jul 2, 2013 · 6 comments
Labels
bugzilla Issues migrated from bugzilla clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature good first issue https://github.com/llvm/llvm-project/contribute

Comments

@silvasean
Copy link
Contributor

silvasean commented Jul 2, 2013

Bugzilla Link 16518
Version trunk
OS All
CC @mydeveloperday

Extended Description

Before:

class X {
  int Y;
public:
  int Z;
};

After:

class X {
  int Y;

public:
  int Z;
};

It would be nice if clang-format had an option to suppress this behavior.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 28, 2013

Patches are welcome :-).

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 21, 2020

Patch which adds option to disable forced insertion of empty line before access modifiers.
Attached patch adds new option called InsertEmptyLineBeforeAccessModifier. Empty line before access modifier is inserted if this option is set to true (which is the default value, because clang-format always inserts empty lines before access modifiers), otherwise empty lines are removed.

I do not know if it is enough to have a boolean value, or a third value is needed to disable both behaviors (neither insert, nor remove empty lines before access modifiers).

@mydeveloperday
Copy link
Contributor

Would you like to submit this patch?

https://llvm.org/docs/Contributing.html

If so feel free to add me as a reviewer

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#41870

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@mydeveloperday mydeveloperday added enhancement Improving things as opposed to bug fixing, e.g. new or missing feature good first issue https://github.com/llvm/llvm-project/contribute labels Dec 14, 2021
@Shanchax
Copy link

Shanchax commented Jul 4, 2023

Is this issue fixed? I'd like to work on it. I'm a beginner and novice so help and guidance would be appreciated

@shafik shafik changed the title Add flag to suppress empty line insertion before access modifier. [clang-format] Add flag to suppress empty line insertion before access modifier. Jul 4, 2023
@xgupta
Copy link
Contributor

xgupta commented Sep 25, 2023

I think this issue is fixed in 60bf582.
It can be enabled with -
"EmptyLineBeforeAccessModifier": "Never"

@xgupta xgupta closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature good first issue https://github.com/llvm/llvm-project/contribute
Projects
None yet
Development

No branches or pull requests

5 participants