Skip to content

Commit ae88d9c

Browse files
authored
Merge pull request #350 from codereport/fea-add-clang-format
[REVIEW] Add .clang-format file & format all files
2 parents 8c8c846 + 80b5901 commit ae88d9c

File tree

16 files changed

+2416
-2897
lines changed

16 files changed

+2416
-2897
lines changed

.clang-format

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
# Refer to the following link for the explanation of each params:
3+
# http://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html
4+
Language: Cpp
5+
# BasedOnStyle: Google
6+
AccessModifierOffset: -1
7+
AlignAfterOpenBracket: Align
8+
AlignConsecutiveAssignments: true
9+
AlignConsecutiveDeclarations: false
10+
AlignEscapedNewlines: Left
11+
AlignOperands: true
12+
AlignTrailingComments: true
13+
AllowAllParametersOfDeclarationOnNextLine: true
14+
AllowShortBlocksOnASingleLine: true
15+
AllowShortCaseLabelsOnASingleLine: true
16+
AllowShortFunctionsOnASingleLine: All
17+
AllowShortIfStatementsOnASingleLine: true
18+
AllowShortLoopsOnASingleLine: false
19+
# This is deprecated
20+
AlwaysBreakAfterDefinitionReturnType: All
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: true
23+
AlwaysBreakTemplateDeclarations: Yes
24+
BinPackArguments: false
25+
BinPackParameters: false
26+
BraceWrapping:
27+
AfterClass: false
28+
AfterControlStatement: false
29+
AfterEnum: false
30+
AfterFunction: false
31+
AfterNamespace: false
32+
AfterObjCDeclaration: false
33+
AfterStruct: false
34+
AfterUnion: false
35+
AfterExternBlock: false
36+
BeforeCatch: false
37+
BeforeElse: false
38+
IndentBraces: false
39+
# disabling the below splits, else, they'll just add to the vertical length of source files!
40+
SplitEmptyFunction: false
41+
SplitEmptyRecord: false
42+
SplitEmptyNamespace: false
43+
BreakBeforeBinaryOperators: None
44+
BreakBeforeBraces: Attach
45+
BreakBeforeInheritanceComma: false
46+
BreakInheritanceList: BeforeColon
47+
BreakBeforeTernaryOperators: true
48+
BreakConstructorInitializersBeforeComma: false
49+
BreakConstructorInitializers: BeforeColon
50+
BreakAfterJavaFieldAnnotations: false
51+
BreakStringLiterals: true
52+
ColumnLimit: 100
53+
CommentPragmas: '^ IWYU pragma:'
54+
CompactNamespaces: false
55+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
56+
# Kept the below 2 to be the same as `IndentWidth` to keep everything uniform
57+
ConstructorInitializerIndentWidth: 2
58+
ContinuationIndentWidth: 2
59+
Cpp11BracedListStyle: true
60+
DerivePointerAlignment: true
61+
DisableFormat: false
62+
ExperimentalAutoDetectBinPacking: false
63+
FixNamespaceComments: true
64+
ForEachMacros:
65+
- foreach
66+
- Q_FOREACH
67+
- BOOST_FOREACH
68+
IncludeBlocks: Preserve
69+
IncludeCategories:
70+
- Regex: '^<ext/.*\.h>'
71+
Priority: 2
72+
- Regex: '^<.*\.h>'
73+
Priority: 1
74+
- Regex: '^<.*'
75+
Priority: 2
76+
- Regex: '.*'
77+
Priority: 3
78+
IncludeIsMainRegex: '([-_](test|unittest))?$'
79+
IndentCaseLabels: true
80+
IndentPPDirectives: None
81+
IndentWidth: 2
82+
IndentWrappedFunctionNames: false
83+
JavaScriptQuotes: Leave
84+
JavaScriptWrapImports: true
85+
KeepEmptyLinesAtTheStartOfBlocks: false
86+
MacroBlockBegin: ''
87+
MacroBlockEnd: ''
88+
MaxEmptyLinesToKeep: 1
89+
NamespaceIndentation: None
90+
ObjCBinPackProtocolList: Never
91+
ObjCBlockIndentWidth: 2
92+
ObjCSpaceAfterProperty: false
93+
ObjCSpaceBeforeProtocolList: true
94+
PenaltyBreakAssignment: 2
95+
PenaltyBreakBeforeFirstCallParameter: 1
96+
PenaltyBreakComment: 300
97+
PenaltyBreakFirstLessLess: 120
98+
PenaltyBreakString: 1000
99+
PenaltyBreakTemplateDeclaration: 10
100+
PenaltyExcessCharacter: 1000000
101+
PenaltyReturnTypeOnItsOwnLine: 200
102+
PointerAlignment: Left
103+
RawStringFormats:
104+
- Language: Cpp
105+
Delimiters:
106+
- cc
107+
- CC
108+
- cpp
109+
- Cpp
110+
- CPP
111+
- 'c++'
112+
- 'C++'
113+
CanonicalDelimiter: ''
114+
- Language: TextProto
115+
Delimiters:
116+
- pb
117+
- PB
118+
- proto
119+
- PROTO
120+
EnclosingFunctions:
121+
- EqualsProto
122+
- EquivToProto
123+
- PARSE_PARTIAL_TEXT_PROTO
124+
- PARSE_TEST_PROTO
125+
- PARSE_TEXT_PROTO
126+
- ParseTextOrDie
127+
- ParseTextProtoOrDie
128+
CanonicalDelimiter: ''
129+
BasedOnStyle: google
130+
# Enabling comment reflow causes doxygen comments to be messed up in their formats!
131+
ReflowComments: false
132+
SortIncludes: true
133+
SortUsingDeclarations: true
134+
SpaceAfterCStyleCast: false
135+
SpaceAfterTemplateKeyword: true
136+
SpaceBeforeAssignmentOperators: true
137+
SpaceBeforeCpp11BracedList: false
138+
SpaceBeforeCtorInitializerColon: true
139+
SpaceBeforeInheritanceColon: true
140+
SpaceBeforeParens: ControlStatements
141+
SpaceBeforeRangeBasedForLoopColon: true
142+
SpaceInEmptyParentheses: false
143+
SpacesBeforeTrailingComments: 2
144+
SpacesInAngles: false
145+
SpacesInContainerLiterals: true
146+
SpacesInCStyleCastParentheses: false
147+
SpacesInParentheses: false
148+
SpacesInSquareBrackets: false
149+
Standard: Cpp11
150+
StatementMacros:
151+
- Q_UNUSED
152+
- QT_REQUIRE_VERSION
153+
# Be consistent with indent-width, even for people who use tab for indentation!
154+
TabWidth: 2
155+
UseTab: Never

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- PR #343 Add in option to statically link against cudart
77

88
## Improvements
9+
- PR #350 Add .clang-format file & format all files
910

1011
## Bug Fixes
1112
- PR #346 Add clearer exception message when RMM_LOG_FILE is unset

0 commit comments

Comments
 (0)