-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FORMAT] Add .clang-format for C++ code
Signed-off-by: nileshnegi <[email protected]>
- Loading branch information
1 parent
6178556
commit 4ce9d58
Showing
2 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Style file for MLSE Libraries based on the modified rocBLAS style | ||
|
||
# Common settings | ||
BasedOnStyle: WebKit | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
UseTab: Never | ||
ColumnLimit: 100 | ||
UseCRLF: false | ||
|
||
# Other languages JavaScript, Proto | ||
|
||
--- | ||
Language: Json | ||
DisableFormat: true | ||
|
||
--- | ||
Language: Cpp | ||
|
||
# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code | ||
# int formatted_code; | ||
# // clang-format off | ||
# void unformatted_code ; | ||
# // clang-format on | ||
# void formatted_code_again; | ||
|
||
DisableFormat: false | ||
Standard: Cpp11 | ||
|
||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: true | ||
AlignArrayOfStructures: Right | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: true | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: false | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BitFieldColonSpacing: Both | ||
|
||
# Configure each individual brace in BraceWrapping | ||
BreakBeforeBraces: Custom | ||
# Control of individual brace wrapping cases | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterClass: true | ||
AfterControlStatement: Always | ||
AfterEnum: true | ||
AfterExternBlock: false | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
BeforeLambdaBody: true | ||
BeforeWhile: true | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
|
||
BreakBeforeBinaryOperators: All | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeComma | ||
BreakInheritanceList: BeforeComma | ||
BreakStringLiterals: true | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DeriveLineEnding: false | ||
DerivePointerAlignment: false | ||
EmptyLineAfterAccessModifier: Never | ||
EmptyLineBeforeAccessModifier: Always | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: [] | ||
IfMacros: [] | ||
IncludeBlocks: Preserve | ||
IndentAccessModifiers: false | ||
IndentCaseBlocks: true | ||
IndentCaseLabels: true | ||
IndentExternBlock: NoIndent | ||
IndentPPDirectives: BeforeHash | ||
IndentWrappedFunctionNames: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
LambdaBodyIndentation: Signature | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
PPIndentWidth: -1 | ||
PackConstructorInitializers: NextLine | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Left | ||
QualifierAlignment: Leave | ||
ReferenceAlignment: Pointer | ||
ReflowComments: false | ||
ShortNamespaceLines: 0 | ||
SortIncludes: CaseSensitive | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceAroundPointerQualifiers: Default | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: Never | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: Never | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: true | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
|
||
AttributeMacros: ['__host__', '__device__', '__global__', '__forceinline__', '__shared__', '__launch_bounds__'] | ||
# Trick clang into thinking that our C-style attributes are C++-style attributes | ||
Macros: | ||
- __host__=[[host]] | ||
- __device__=[[device]] | ||
- __global__=[[global]] | ||
- __forceinline__=[[forceinline]] | ||
- __shared__=[[shared]] | ||
- __launch_bounds__(x)=[[launch_bounds(x)]] | ||
- __attribute__(x)=[[attribute(x)]] | ||
BreakAfterAttributes: Always | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters