Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
BasedOnStyle : LLVM
# Indent formatting
IndentWidth : 2
Language: Cpp
UseTab: Never
KeepEmptyLinesAtTheStartOfBlocks : true
MaxEmptyLinesToKeep : 2
AccessModifierOffset : -2
# This must be off so that include order in RAJA is preserved
SortIncludes: false

# Alignment of consecutive declarations, assignments etc
AlignConsecutiveAssignments : true
AlignConsecutiveDeclarations : false
AlignConsecutiveMacros : true
AlignTrailingComments : true

# Control curly brace placement
BreakBeforeBraces : Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

# Pointer alignment
DerivePointerAlignment: false
PointerAlignment: Left

# Single line config
AllowShortIfStatementsOnASingleLine : true
AllowShortFunctionsOnASingleLine : true
AllowShortLoopsOnASingleLine : false
AllowShortLambdasOnASingleLine : None
PackConstructorInitializers : CurrentLine
AllowAllArgumentsOnNextLine : true
AllowAllParametersOfDeclarationOnNextLine : false
BinPackArguments : true
BinPackParameters : false
ConstructorInitializerAllOnOneLineOrOnePerLine : true
ColumnLimit : 80

AlignAfterOpenBracket: Align
AlignOperands : true
AlwaysBreakTemplateDeclarations : true
AlwaysBreakAfterDefinitionReturnType : None
PenaltyReturnTypeOnItsOwnLine : 10000
BreakBeforeBinaryOperators : None

# Indents
IndentCaseLabels: true

# Lambda body
LambdaBodyIndentation : Signature

SeparateDefinitionBlocks : Always

# Space before/after settings
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInConditionalStatement: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ endif()
# exclude RAJA make targets from top-level build...
add_subdirectory(tpl/RAJA)

# Bring in RAJA macros so we can replicate RAJA's formatting
include(tpl/RAJA/cmake/RAJAMacros.cmake)
# Setup the style target
raja_add_code_checks(DIRS "src" "test")

get_property(RAJA_INCLUDE_DIRS DIRECTORY tpl/RAJA PROPERTY INCLUDE_DIRECTORIES)
include_directories(${RAJA_INCLUDE_DIRS})

Expand Down
2 changes: 1 addition & 1 deletion tpl/RAJA