llvm-project/clang/test/Format/access-modifiers.cpp
Albertas Vyšniauskas 60bf5826cf [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier
Add new option called InsertEmptyLineBeforeAccessModifier. Empty line
before access modifier is inerted 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.

Fixes issue #16518.

Differential Revision: https://reviews.llvm.org/D93846
2021-01-25 21:02:41 +01:00

64 lines
965 B
C++

// RUN: grep -Ev "// *[A-Z-]+:" %s \
// RUN: | clang-format -style="{BasedOnStyle: LLVM, EmptyLineBeforeAccessModifier: LogicalBlock}" -lines=1:14 \
// RUN: | clang-format -style="{BasedOnStyle: LLVM, EmptyLineBeforeAccessModifier: Never}" -lines=14:40 \
// RUN: | FileCheck -strict-whitespace %s
// CHECK: int i
// CHECK-NEXT: {{^$}}
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct foo1 {
int i;
private:
int j;
};
// CHECK: struct bar1
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct bar1 {
private:
int i;
int j;
};
// CHECK: int i
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct foo2 {
int i;
private:
int j;
};
// CHECK: struct bar2
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct bar2 {
private:
int i;
int j;
};
// CHECK: int j
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct foo3 {
int i;
int j;
private:
};
// CHECK: struct bar3
// CHECK-NEXT: {{^private:$}}
// CHECK: }
struct bar3 {
private:
int i;
int j;
};