Prog/formatter/clang-format
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#zf6aaa09]
#contents();
/////////////////////////////////////////////////////////...
* 書式オプション(抜粋) [#cbbe2cff]
- clang-format で使用される書式設定ファイル ''.clang-form...
//=======================================================...
** Language: [#Language]
|~val |~description |
|None |使用しない |
|Cpp |C, C++, Objective-C, Objective-C++ を使用す...
|Java |Java を使用する |
|JavaScript |JavaScript を使用する |
|Proto |[[Protocol Buffers>https://developers.google...
//=======================================================...
** AccessModifierOffset: [#AccessModifierOffset]
- アクセス修飾子(C++ class の public:, private:, protect...
- パラメータと挙動
-- ''0''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
char* m_b;
uint64_t m_c;
};
-- ''-2''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
int m_a;
char* m_b;
uint64_t m_c;
};
-- ''-4''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
int m_a;
char* m_b;
uint64_t m_c;
};
//=======================================================...
** AlignAfterOpenBracket: [#AlignAfterOpenBracket]
- 括弧 (()、<>、[]) 内のパラメータが1行に収まらない場合の...
- パラメータと挙動
-- Align
// 仮引数は、カラム上限にかかった場合に改行される。仮引...
void func_c(std::string& hoge_name, std::vector<std::str...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
-- DontAlign
// 仮引数は、カラム上限にかかった場合に改行される。仮引...
void func_c(std::string& hoge_name, std::vector<std::str...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
-- AlwaysBreak
// 仮引数は、先頭と、カラム上限にかかった場合に改行され...
void func_c(
std::string& hoge_name, std::vector<std::string>& na...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
//=======================================================...
** AlignConsecutiveAssignments: [#AlignConsecutiveAssignm...
- 連続する行の代入式を ''='' で整列するか否か
- パラメータと挙動
-- true : 整列する
int32_t var_1 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
-- false : 整列しない
int32_t var_1 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
//=======================================================...
** AlignConsecutiveDeclarations: [#AlignConsecutiveDeclar...
- 連続する行の宣言の変数名を整列させるか否か
- パラメータと挙動
-- true : 整列する
int32_t var_11 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
-- false : 整列しない
int32_t var_11 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
//=======================================================...
** AlignEscapedNewlinesLeft: [#AlignEscapedNewlinesLeft]
- エスケープされた改行の位置を調整する
- パラメータと挙動
-- true : 可能な限り左に寄せる
#define LOG_PREFIX \
"[DEBUG]" \
"[MODULE_A]" \
"[MOD_SUB_2]"
-- false : column limit に配置する
// ColumnLimit: 80 の場合
#define LOG_PREFIX ...
"[DEBUG]" ...
"[MODULE_A]" ...
"[MOD_SUB_2]"
//=======================================================...
** AlignOperands: [#n00eac18]
//=======================================================...
** AlignTrailingComments: [#vfbf452b]
//=======================================================...
** AllowAllParametersOfDeclarationOnNextLine: [#sae7368d]
//=======================================================...
** AllowShortBlocksOnASingleLine: [#AllowShortBlocksOnASi...
- 短いブレース文を単一の行に押し込むか否か
- パラメータと挙動
- true : 単一行に押し込む
if (arg > 10) { var_11 += arg; }
- false : 単一行に押し込まない
if (arg > 10) {
var_11 += arg;
}
- 但し、以下のような構造体初期化文には効力がない模様
st_aaa aaa = {
0,
};
//=======================================================...
** AllowShortCaseLabelsOnASingleLine: [#AllowShortCaseLab...
- switch-case 文に於いて、短い case 文を1行で書くことを許...
- true 短い case 文を1行にする
switch (tcx_type) {
case TCX_TYPE1: break;
case TCX_TYPE2: break;
case TCX_TYPE2_NORMAL_STYLE: break;
case TCX_TYPE3: break;
case TCX_TYPE3_______________________________LONG: b...
default:
break;
}
- false 短い case 文を1行にしない。
switch (tcx_type) {
case TCX_TYPE1:
break;
case TCX_TYPE2:
break;
case TCX_TYPE2_NORMAL_STYLE:
break;
case TCX_TYPE3:
break;
case TCX_TYPE3_______________________________LONG:
break;
default:
break;
}
//=======================================================...
** AllowShortFunctionsOnASingleLine: [#dce76bfa]
//=======================================================...
** AllowShortIfStatementsOnASingleLine: [#w26c3548]
//=======================================================...
** AllowShortLoopsOnASingleLine: [#kff2e776]
//=======================================================...
** AlwaysBreakAfterDefinitionReturnType: [#e2cf0f79]
//=======================================================...
** AlwaysBreakAfterReturnType: [#u32cd482]
//=======================================================...
** AlwaysBreakBeforeMultilineStrings: [#v40e1938]
//=======================================================...
** AlwaysBreakTemplateDeclarations: [#y25557f4]
//=======================================================...
** BinPackArguments: [#ia3d009b]
//=======================================================...
** BinPackParameters: [#v9fb1dea]
//=======================================================...
** BraceWrapping: [#n9ac2f6f]
//-------------------------------------------------------...
*** AfterClass: [#r3ca3958]
//-------------------------------------------------------...
*** AfterControlStatement: [#kae57280]
//-------------------------------------------------------...
*** AfterEnum: [#k51b89c7]
//-------------------------------------------------------...
*** AfterFunction: [#a31f9cf9]
//-------------------------------------------------------...
*** AfterNamespace: [#c3c1226f]
//-------------------------------------------------------...
*** AfterObjCDeclaration: [#c89d4168]
//-------------------------------------------------------...
*** AfterStruct: [#g2564b61]
//-------------------------------------------------------...
*** AfterUnion: [#haacaa46]
//-------------------------------------------------------...
*** BeforeCatch: [#ae2a006c]
//-------------------------------------------------------...
*** BeforeElse: [#m3b859c3]
//-------------------------------------------------------...
*** IndentBraces: [#w79f7cc5]
//=======================================================...
** BreakBeforeBinaryOperators: [#eba844fb]
|~style |~style option |
|LLVM |BasedOnStyle: LLVM |
|google |BasedOnStyle: Google |
|Chromium |BasedOnStyle: Chromium |
|Mozilla |BasedOnStyle: Mozilla |
|WebKit |BasedOnStyle: WebKit |
|linux |BasedOnStyle: LLVM |
|~| IndentWidth: 8 |
|~| UseTab: Always |
|~| BreakBeforeBraces: Linux |
|~| AllowShortIfStatementsOnASingleLine: fa...
|~| IndentCaseLabels: false |
|Visual Studio |UseTab: Never |
|~| IndentWidth: 4 |
|~| BreakBeforeBraces: Allman |
|~| AllowShortIfStatementsOnASingleLine: fa...
|~| IndentCaseLabels: false |
|~| ColumnLimit: 0 |
//=======================================================...
** BreakBeforeBraces: [#BreakBeforeBraces]
- 波括弧 ''{ }'' の改行の設定
- パラメータと挙動
-- Attach
// 波括弧は常に周囲のコンテキストにくっつける。
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg) {
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Linux
// Attach に似るが、関数や名前空間、クラス定義の前は改行...
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Mozilla
// Attach と似るが、 enum、関数定義などの前には改行する。
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Stroustrup
// Attach と似るが、catch, else などの前は改行する。
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
}
else {
// ...
}
return;
}
-- Allman
// 波括弧の前は全て改行する。
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0)
{
// ...
}
else
{
// ...
}
return;
}
-- GNU
// 波括弧の前は全て改行するし、新たにインデントを加える...
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0)
{
// ...
}
else
{
// ...
}
return;
}
//=======================================================...
** BreakBeforeTernaryOperators: [#sffea887]
//=======================================================...
** BreakConstructorInitializersBeforeComma: [#r8e30fba]
- コンストラクタの変数初期化のコンマの前で改行し、コンマ...
- パラメータと挙動
-- true
-- false
//=======================================================...
** ColumnLimit: [#ColumnLimit]
- 行の長さの上限値。
- 0 に設定した場合は、上限なしとなる。
//=======================================================...
** CommentPragmas: [#u99be49b]
//=======================================================...
** ConstructorInitializerAllOnOneLineOrOnePerLine: [#r752...
//=======================================================...
** ConstructorInitializerIndentWidth: [#ze984459]
//=======================================================...
** ContinuationIndentWidth: [#aaefdf2a]
//=======================================================...
** Cpp11BracedListStyle: [#iedfc19b]
//=======================================================...
** DerivePointerAlignment: [#f9b31830]
//=======================================================...
** DisableFormat: [#v21da5cf]
//=======================================================...
** ExperimentalAutoDetectBinPacking: [#q9649d58]
//=======================================================...
** ForEachMacros: [#e39475f0]
//=======================================================...
** IncludeCategories: [#ucb42990]
//-------------------------------------------------------...
*** - [#be585d44]
//-------------------------------------------------------...
*** Priority: [#lc646fac]
//-------------------------------------------------------...
*** - [#w1262625]
//-------------------------------------------------------...
*** Priority: [#hde528d1]
//-------------------------------------------------------...
*** - [#l3196565]
//-------------------------------------------------------...
*** Priority: [#g1cb84bf]
//=======================================================...
** IndentCaseLabels: [#x3a42b57]
//=======================================================...
** IndentWidth: [#d4935225]
//=======================================================...
** IndentWrappedFunctionNames: [#vb5d40c0]
//=======================================================...
** KeepEmptyLinesAtTheStartOfBlocks: [#n643d905]
//=======================================================...
** MacroBlockBegin: [#h7d1a026]
//=======================================================...
** MacroBlockEnd: [#k77ca862]
//=======================================================...
** MaxEmptyLinesToKeep: [#mf4db716]
//=======================================================...
** NamespaceIndentation: [#o82a7483]
//=======================================================...
** ObjCBlockIndentWidth: [#d2ad2676]
//=======================================================...
** ObjCSpaceAfterProperty: [#p8f59fc2]
//=======================================================...
** ObjCSpaceBeforeProtocolList: [#rc1aedf9]
//=======================================================...
** PenaltyBreakBeforeFirstCallParameter: [#b8c42877]
//=======================================================...
** PenaltyBreakComment: [#s63e6446]
//=======================================================...
** PenaltyBreakFirstLessLess: [#v647e833]
//=======================================================...
** PenaltyBreakString: [#qbd919c2]
//=======================================================...
** PenaltyExcessCharacter: [#t230560c]
//=======================================================...
** PenaltyReturnTypeOnItsOwnLine: [#cc33121d]
//=======================================================...
** PointerAlignment: [#v30bb7ce]
//=======================================================...
** ReflowComments: [#ucf9ed66]
//=======================================================...
** SortIncludes: [#b6797f9d]
//=======================================================...
** SpaceAfterCStyleCast: [#uebb1034]
//=======================================================...
** SpaceBeforeAssignmentOperators: [#x29447e9]
//=======================================================...
** SpaceBeforeParens: [#iacb23cc]
//=======================================================...
** SpaceInEmptyParentheses: [#t24393b1]
//=======================================================...
** SpacesBeforeTrailingComments: [#da132129]
//=======================================================...
** SpacesInAngles: [#i7770e5a]
//=======================================================...
** SpacesInContainerLiterals: [#k77db928]
//=======================================================...
** SpacesInCStyleCastParentheses: [#w07105c2]
//=======================================================...
** SpacesInParentheses: [#d281fbe1]
//=======================================================...
** SpacesInSquareBrackets: [#m8113bc9]
//=======================================================...
** Standard: [#z92f7f34]
//=======================================================...
** TabWidth: [#pbdbd121]
//=======================================================...
** UseTab: [#f5d7899e]
/////////////////////////////////////////////////////////...
* 参考リンク [#links]
- [[ClangFormat — Algo13 2016.12.17 ドキュメント>http://a...
- [[clang-format を イイ感じに設定する - def yasuharu519(...
終了行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#zf6aaa09]
#contents();
/////////////////////////////////////////////////////////...
* 書式オプション(抜粋) [#cbbe2cff]
- clang-format で使用される書式設定ファイル ''.clang-form...
//=======================================================...
** Language: [#Language]
|~val |~description |
|None |使用しない |
|Cpp |C, C++, Objective-C, Objective-C++ を使用す...
|Java |Java を使用する |
|JavaScript |JavaScript を使用する |
|Proto |[[Protocol Buffers>https://developers.google...
//=======================================================...
** AccessModifierOffset: [#AccessModifierOffset]
- アクセス修飾子(C++ class の public:, private:, protect...
- パラメータと挙動
-- ''0''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
char* m_b;
uint64_t m_c;
};
-- ''-2''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
int m_a;
char* m_b;
uint64_t m_c;
};
-- ''-4''
class CFoo : public CSuperFoo
{
public:
CFoo(int ini_a, char* ini_b) : m_a(ini_a), m_b(ini_b...
private:
int m_a;
char* m_b;
uint64_t m_c;
};
//=======================================================...
** AlignAfterOpenBracket: [#AlignAfterOpenBracket]
- 括弧 (()、<>、[]) 内のパラメータが1行に収まらない場合の...
- パラメータと挙動
-- Align
// 仮引数は、カラム上限にかかった場合に改行される。仮引...
void func_c(std::string& hoge_name, std::vector<std::str...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
-- DontAlign
// 仮引数は、カラム上限にかかった場合に改行される。仮引...
void func_c(std::string& hoge_name, std::vector<std::str...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
-- AlwaysBreak
// 仮引数は、先頭と、カラム上限にかかった場合に改行され...
void func_c(
std::string& hoge_name, std::vector<std::string>& na...
std::vector<uint64_t> param_list)
{
uint32_t local_count(0);
for (std::vector<std::string>::iterator it_of_name_l...
it_of_name_list != name_list.end();
++it_of_name_list) {
uint32_t ret =
sub_func(hoge_name, *it_of_name_list, param_...
++local_count;
}
// カラム上限に達していなければ改行されない
for (uint32_t i = 1; i < max_count; ++i) {
sub_func_2(hoge_name, name_list, param_list);
}
}
//=======================================================...
** AlignConsecutiveAssignments: [#AlignConsecutiveAssignm...
- 連続する行の代入式を ''='' で整列するか否か
- パラメータと挙動
-- true : 整列する
int32_t var_1 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
-- false : 整列しない
int32_t var_1 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
//=======================================================...
** AlignConsecutiveDeclarations: [#AlignConsecutiveDeclar...
- 連続する行の宣言の変数名を整列させるか否か
- パラメータと挙動
-- true : 整列する
int32_t var_11 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
-- false : 整列しない
int32_t var_11 = 12;
std::string var_2 = "foo";
const char* const var_3 = "bar";
//=======================================================...
** AlignEscapedNewlinesLeft: [#AlignEscapedNewlinesLeft]
- エスケープされた改行の位置を調整する
- パラメータと挙動
-- true : 可能な限り左に寄せる
#define LOG_PREFIX \
"[DEBUG]" \
"[MODULE_A]" \
"[MOD_SUB_2]"
-- false : column limit に配置する
// ColumnLimit: 80 の場合
#define LOG_PREFIX ...
"[DEBUG]" ...
"[MODULE_A]" ...
"[MOD_SUB_2]"
//=======================================================...
** AlignOperands: [#n00eac18]
//=======================================================...
** AlignTrailingComments: [#vfbf452b]
//=======================================================...
** AllowAllParametersOfDeclarationOnNextLine: [#sae7368d]
//=======================================================...
** AllowShortBlocksOnASingleLine: [#AllowShortBlocksOnASi...
- 短いブレース文を単一の行に押し込むか否か
- パラメータと挙動
- true : 単一行に押し込む
if (arg > 10) { var_11 += arg; }
- false : 単一行に押し込まない
if (arg > 10) {
var_11 += arg;
}
- 但し、以下のような構造体初期化文には効力がない模様
st_aaa aaa = {
0,
};
//=======================================================...
** AllowShortCaseLabelsOnASingleLine: [#AllowShortCaseLab...
- switch-case 文に於いて、短い case 文を1行で書くことを許...
- true 短い case 文を1行にする
switch (tcx_type) {
case TCX_TYPE1: break;
case TCX_TYPE2: break;
case TCX_TYPE2_NORMAL_STYLE: break;
case TCX_TYPE3: break;
case TCX_TYPE3_______________________________LONG: b...
default:
break;
}
- false 短い case 文を1行にしない。
switch (tcx_type) {
case TCX_TYPE1:
break;
case TCX_TYPE2:
break;
case TCX_TYPE2_NORMAL_STYLE:
break;
case TCX_TYPE3:
break;
case TCX_TYPE3_______________________________LONG:
break;
default:
break;
}
//=======================================================...
** AllowShortFunctionsOnASingleLine: [#dce76bfa]
//=======================================================...
** AllowShortIfStatementsOnASingleLine: [#w26c3548]
//=======================================================...
** AllowShortLoopsOnASingleLine: [#kff2e776]
//=======================================================...
** AlwaysBreakAfterDefinitionReturnType: [#e2cf0f79]
//=======================================================...
** AlwaysBreakAfterReturnType: [#u32cd482]
//=======================================================...
** AlwaysBreakBeforeMultilineStrings: [#v40e1938]
//=======================================================...
** AlwaysBreakTemplateDeclarations: [#y25557f4]
//=======================================================...
** BinPackArguments: [#ia3d009b]
//=======================================================...
** BinPackParameters: [#v9fb1dea]
//=======================================================...
** BraceWrapping: [#n9ac2f6f]
//-------------------------------------------------------...
*** AfterClass: [#r3ca3958]
//-------------------------------------------------------...
*** AfterControlStatement: [#kae57280]
//-------------------------------------------------------...
*** AfterEnum: [#k51b89c7]
//-------------------------------------------------------...
*** AfterFunction: [#a31f9cf9]
//-------------------------------------------------------...
*** AfterNamespace: [#c3c1226f]
//-------------------------------------------------------...
*** AfterObjCDeclaration: [#c89d4168]
//-------------------------------------------------------...
*** AfterStruct: [#g2564b61]
//-------------------------------------------------------...
*** AfterUnion: [#haacaa46]
//-------------------------------------------------------...
*** BeforeCatch: [#ae2a006c]
//-------------------------------------------------------...
*** BeforeElse: [#m3b859c3]
//-------------------------------------------------------...
*** IndentBraces: [#w79f7cc5]
//=======================================================...
** BreakBeforeBinaryOperators: [#eba844fb]
|~style |~style option |
|LLVM |BasedOnStyle: LLVM |
|google |BasedOnStyle: Google |
|Chromium |BasedOnStyle: Chromium |
|Mozilla |BasedOnStyle: Mozilla |
|WebKit |BasedOnStyle: WebKit |
|linux |BasedOnStyle: LLVM |
|~| IndentWidth: 8 |
|~| UseTab: Always |
|~| BreakBeforeBraces: Linux |
|~| AllowShortIfStatementsOnASingleLine: fa...
|~| IndentCaseLabels: false |
|Visual Studio |UseTab: Never |
|~| IndentWidth: 4 |
|~| BreakBeforeBraces: Allman |
|~| AllowShortIfStatementsOnASingleLine: fa...
|~| IndentCaseLabels: false |
|~| ColumnLimit: 0 |
//=======================================================...
** BreakBeforeBraces: [#BreakBeforeBraces]
- 波括弧 ''{ }'' の改行の設定
- パラメータと挙動
-- Attach
// 波括弧は常に周囲のコンテキストにくっつける。
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg) {
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Linux
// Attach に似るが、関数や名前空間、クラス定義の前は改行...
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Mozilla
// Attach と似るが、 enum、関数定義などの前には改行する。
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
} else {
// ...
}
return;
}
-- Stroustrup
// Attach と似るが、catch, else などの前は改行する。
enum HOGE_EN {
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa {
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0) {
// ...
}
else {
// ...
}
return;
}
-- Allman
// 波括弧の前は全て改行する。
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0)
{
// ...
}
else
{
// ...
}
return;
}
-- GNU
// 波括弧の前は全て改行するし、新たにインデントを加える...
enum HOGE_EN
{
EN_AAA,
EN_ABC,
EN_ZZZ,
};
struct st_aaa
{
int aaa[2];
uint64_t ax;
};
void func(int arg)
{
// ...
if (arg == 0)
{
// ...
}
else
{
// ...
}
return;
}
//=======================================================...
** BreakBeforeTernaryOperators: [#sffea887]
//=======================================================...
** BreakConstructorInitializersBeforeComma: [#r8e30fba]
- コンストラクタの変数初期化のコンマの前で改行し、コンマ...
- パラメータと挙動
-- true
-- false
//=======================================================...
** ColumnLimit: [#ColumnLimit]
- 行の長さの上限値。
- 0 に設定した場合は、上限なしとなる。
//=======================================================...
** CommentPragmas: [#u99be49b]
//=======================================================...
** ConstructorInitializerAllOnOneLineOrOnePerLine: [#r752...
//=======================================================...
** ConstructorInitializerIndentWidth: [#ze984459]
//=======================================================...
** ContinuationIndentWidth: [#aaefdf2a]
//=======================================================...
** Cpp11BracedListStyle: [#iedfc19b]
//=======================================================...
** DerivePointerAlignment: [#f9b31830]
//=======================================================...
** DisableFormat: [#v21da5cf]
//=======================================================...
** ExperimentalAutoDetectBinPacking: [#q9649d58]
//=======================================================...
** ForEachMacros: [#e39475f0]
//=======================================================...
** IncludeCategories: [#ucb42990]
//-------------------------------------------------------...
*** - [#be585d44]
//-------------------------------------------------------...
*** Priority: [#lc646fac]
//-------------------------------------------------------...
*** - [#w1262625]
//-------------------------------------------------------...
*** Priority: [#hde528d1]
//-------------------------------------------------------...
*** - [#l3196565]
//-------------------------------------------------------...
*** Priority: [#g1cb84bf]
//=======================================================...
** IndentCaseLabels: [#x3a42b57]
//=======================================================...
** IndentWidth: [#d4935225]
//=======================================================...
** IndentWrappedFunctionNames: [#vb5d40c0]
//=======================================================...
** KeepEmptyLinesAtTheStartOfBlocks: [#n643d905]
//=======================================================...
** MacroBlockBegin: [#h7d1a026]
//=======================================================...
** MacroBlockEnd: [#k77ca862]
//=======================================================...
** MaxEmptyLinesToKeep: [#mf4db716]
//=======================================================...
** NamespaceIndentation: [#o82a7483]
//=======================================================...
** ObjCBlockIndentWidth: [#d2ad2676]
//=======================================================...
** ObjCSpaceAfterProperty: [#p8f59fc2]
//=======================================================...
** ObjCSpaceBeforeProtocolList: [#rc1aedf9]
//=======================================================...
** PenaltyBreakBeforeFirstCallParameter: [#b8c42877]
//=======================================================...
** PenaltyBreakComment: [#s63e6446]
//=======================================================...
** PenaltyBreakFirstLessLess: [#v647e833]
//=======================================================...
** PenaltyBreakString: [#qbd919c2]
//=======================================================...
** PenaltyExcessCharacter: [#t230560c]
//=======================================================...
** PenaltyReturnTypeOnItsOwnLine: [#cc33121d]
//=======================================================...
** PointerAlignment: [#v30bb7ce]
//=======================================================...
** ReflowComments: [#ucf9ed66]
//=======================================================...
** SortIncludes: [#b6797f9d]
//=======================================================...
** SpaceAfterCStyleCast: [#uebb1034]
//=======================================================...
** SpaceBeforeAssignmentOperators: [#x29447e9]
//=======================================================...
** SpaceBeforeParens: [#iacb23cc]
//=======================================================...
** SpaceInEmptyParentheses: [#t24393b1]
//=======================================================...
** SpacesBeforeTrailingComments: [#da132129]
//=======================================================...
** SpacesInAngles: [#i7770e5a]
//=======================================================...
** SpacesInContainerLiterals: [#k77db928]
//=======================================================...
** SpacesInCStyleCastParentheses: [#w07105c2]
//=======================================================...
** SpacesInParentheses: [#d281fbe1]
//=======================================================...
** SpacesInSquareBrackets: [#m8113bc9]
//=======================================================...
** Standard: [#z92f7f34]
//=======================================================...
** TabWidth: [#pbdbd121]
//=======================================================...
** UseTab: [#f5d7899e]
/////////////////////////////////////////////////////////...
* 参考リンク [#links]
- [[ClangFormat — Algo13 2016.12.17 ドキュメント>http://a...
- [[clang-format を イイ感じに設定する - def yasuharu519(...
ページ名: