diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..c45d2429e --- /dev/null +++ b/.clang-format @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index b63c849e9..ccb788db3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/tpl/RAJA b/tpl/RAJA index ecc4047f1..292862f0a 160000 --- a/tpl/RAJA +++ b/tpl/RAJA @@ -1 +1 @@ -Subproject commit ecc4047f197f5ad45aa41f8a47b11d5e34ba0978 +Subproject commit 292862f0a2b4f56eaf5bc6ff3e3178cd26919f05