clang  14.0.0git
Public Attributes | List of all members
clang::format::FormatStyle::BraceWrappingFlags Struct Reference

Precise control over the wrapping of braces. More...

#include "clang/Format/Format.h"

Collaboration diagram for clang::format::FormatStyle::BraceWrappingFlags:
Collaboration graph
[legend]

Public Attributes

bool AfterCaseLabel
 Wrap case labels. More...
 
bool AfterClass
 Wrap class definitions. More...
 
BraceWrappingAfterControlStatementStyle AfterControlStatement
 Wrap control statements (if/for/while/switch/..). More...
 
bool AfterEnum
 Wrap enum definitions. More...
 
bool AfterFunction
 Wrap function definitions. More...
 
bool AfterNamespace
 Wrap namespace definitions. More...
 
bool AfterObjCDeclaration
 Wrap ObjC definitions (interfaces, implementations...). More...
 
bool AfterStruct
 Wrap struct definitions. More...
 
bool AfterUnion
 Wrap union definitions. More...
 
bool AfterExternBlock
 Wrap extern blocks. More...
 
bool BeforeCatch
 Wrap before catch. More...
 
bool BeforeElse
 Wrap before else. More...
 
bool BeforeLambdaBody
 Wrap lambda block. More...
 
bool BeforeWhile
 Wrap before while. More...
 
bool IndentBraces
 Indent the wrapped braces themselves. More...
 
bool SplitEmptyFunction
 If false, empty function body can be put on a single line. More...
 
bool SplitEmptyRecord
 If false, empty record (e.g. More...
 
bool SplitEmptyNamespace
 If false, empty namespace body can be put on a single line. More...
 

Detailed Description

Precise control over the wrapping of braces.

# Should be declared this way:
AfterClass: true

Definition at line 1531 of file Format.h.

Member Data Documentation

◆ AfterCaseLabel

bool clang::format::FormatStyle::BraceWrappingFlags::AfterCaseLabel

Wrap case labels.

false: true:
switch (foo) { vs. switch (foo) {
case 1: { case 1:
bar(); {
break; bar();
} break;
default: { }
plop(); default:
} {
} plop();
}
}

Definition at line 1547 of file Format.h.

◆ AfterClass

bool clang::format::FormatStyle::BraceWrappingFlags::AfterClass

Wrap class definitions.

true:
class foo {};
false:
class foo
{};

Definition at line 1557 of file Format.h.

◆ AfterControlStatement

BraceWrappingAfterControlStatementStyle clang::format::FormatStyle::BraceWrappingFlags::AfterControlStatement

Wrap control statements (if/for/while/switch/..).

Definition at line 1560 of file Format.h.

◆ AfterEnum

bool clang::format::FormatStyle::BraceWrappingFlags::AfterEnum

Wrap enum definitions.

true:
enum X : int
{
B
};
false:
enum X : int { B };

Definition at line 1572 of file Format.h.

◆ AfterExternBlock

bool clang::format::FormatStyle::BraceWrappingFlags::AfterExternBlock

Wrap extern blocks.

true:
extern "C"
{
int foo();
}
false:
extern "C" {
int foo();
}

Definition at line 1650 of file Format.h.

◆ AfterFunction

bool clang::format::FormatStyle::BraceWrappingFlags::AfterFunction

Wrap function definitions.

true:
void foo()
{
bar();
bar2();
}
false:
void foo() {
bar();
bar2();
}

Definition at line 1588 of file Format.h.

◆ AfterNamespace

bool clang::format::FormatStyle::BraceWrappingFlags::AfterNamespace

Wrap namespace definitions.

true:
namespace
{
int foo();
int bar();
}
false:
namespace {
int foo();
int bar();
}

Definition at line 1604 of file Format.h.

◆ AfterObjCDeclaration

bool clang::format::FormatStyle::BraceWrappingFlags::AfterObjCDeclaration

Wrap ObjC definitions (interfaces, implementations...).

Note
@autoreleasepool and @synchronized blocks are wrapped according to AfterControlStatement flag.

Definition at line 1608 of file Format.h.

◆ AfterStruct

bool clang::format::FormatStyle::BraceWrappingFlags::AfterStruct

Wrap struct definitions.

true:
struct foo
{
int x;
};
false:
struct foo {
int x;
};

Definition at line 1622 of file Format.h.

◆ AfterUnion

bool clang::format::FormatStyle::BraceWrappingFlags::AfterUnion

Wrap union definitions.

true:
union foo
{
int x;
}
false:
union foo {
int x;
}

Definition at line 1636 of file Format.h.

◆ BeforeCatch

bool clang::format::FormatStyle::BraceWrappingFlags::BeforeCatch

Wrap before catch.

true:
try {
foo();
}
catch () {
}
false:
try {
foo();
} catch () {
}

Definition at line 1666 of file Format.h.

◆ BeforeElse

bool clang::format::FormatStyle::BraceWrappingFlags::BeforeElse

Wrap before else.

true:
if (foo()) {
}
else {
}
false:
if (foo()) {
} else {
}

Definition at line 1680 of file Format.h.

◆ BeforeLambdaBody

bool clang::format::FormatStyle::BraceWrappingFlags::BeforeLambdaBody

Wrap lambda block.

true:
connect(
[]()
{
foo();
bar();
});
false:
connect([]() {
foo();
bar();
});

Definition at line 1697 of file Format.h.

◆ BeforeWhile

bool clang::format::FormatStyle::BraceWrappingFlags::BeforeWhile

Wrap before while.

true:
do {
foo();
}
while (1);
false:
do {
foo();
} while (1);

Definition at line 1711 of file Format.h.

◆ IndentBraces

bool clang::format::FormatStyle::BraceWrappingFlags::IndentBraces

Indent the wrapped braces themselves.

Definition at line 1713 of file Format.h.

◆ SplitEmptyFunction

bool clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyFunction

If false, empty function body can be put on a single line.

This option is used only if the opening brace of the function has already been wrapped, i.e. the AfterFunction brace wrapping mode is set, and the function could/should not be put on a single line (as per AllowShortFunctionsOnASingleLine and constructor formatting options).

int f() vs. int f()
{} {
}

Definition at line 1725 of file Format.h.

◆ SplitEmptyNamespace

bool clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyNamespace

If false, empty namespace body can be put on a single line.

This option is used only if the opening brace of the namespace has already been wrapped, i.e. the AfterNamespace brace wrapping mode is set.

namespace Foo vs. namespace Foo
{} {
}

Definition at line 1747 of file Format.h.

◆ SplitEmptyRecord

bool clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyRecord

If false, empty record (e.g.

class, struct or union) body can be put on a single line. This option is used only if the opening brace of the record has already been wrapped, i.e. the AfterClass (for classes) brace wrapping mode is set.

class Foo vs. class Foo
{} {
}

Definition at line 1736 of file Format.h.


The documentation for this struct was generated from the following file:
clang::tooling::X
static ToolExecutorPluginRegistry::Add< AllTUsToolExecutorPlugin > X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " "Tool results are stored in memory.")
clang::format::FormatStyle::BreakBeforeBraces
BraceBreakingStyle BreakBeforeBraces
The brace breaking style to use.
Definition: Format.h:1488
x
IRgen optimization opportunities The common pattern of short x
Definition: README.txt:7
clang::format::FormatStyle::BraceWrapping
BraceWrappingFlags BraceWrapping
Control of individual brace wrapping cases.
Definition: Format.h:1763
clang::format::FormatStyle::BraceWrappingFlags::AfterClass
bool AfterClass
Wrap class definitions.
Definition: Format.h:1557
clang::XRayInstrKind::Custom
constexpr XRayInstrMask Custom
Definition: XRayInstr.h:41