Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: script to toggle clang-format on/off, clang-format exercises and examples #1748

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
72 changes: 58 additions & 14 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,27 +1,71 @@
BasedOnStyle : google
BasedOnStyle : LLVM
# Indent formatting
IndentWidth : 2
BreakBeforeBraces : Linux
Language: Cpp
UseTab: Never
KeepEmptyLinesAtTheStartOfBlocks : true
MaxEmptyLinesToKeep : 2
AccessModifierOffset : -2
UseTab: Never
# 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
AlwaysBreakAfterDefinitionReturnType: false

# 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: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

# Pointer alignment
DerivePointerAlignment: false
PointerAlignment: Left

# Single line config
AllowShortIfStatementsOnASingleLine : true
ConstructorInitializerAllOnOneLineOrOnePerLine : true
AllowShortFunctionsOnASingleLine : true
AllowShortLoopsOnASingleLine : false
BinPackParameters : false
AllowAllArgumentsOnNextLine : true
AllowAllParametersOfDeclarationOnNextLine : false
AlignTrailingComments : true
BinPackArguments : true
BinPackParameters : false
ConstructorInitializerAllOnOneLineOrOnePerLine : true
ColumnLimit : 80
PenaltyBreakBeforeFirstCallParameter : 100
PenaltyReturnTypeOnItsOwnLine : 65000
PenaltyBreakString : 10

# These improve formatting results but require clang 3.6/7 or higher
BreakBeforeBinaryOperators : None
AlignAfterOpenBracket: true
BinPackArguments : false
AlignAfterOpenBracket: Align
AlignOperands : true
AlwaysBreakTemplateDeclarations : true
Cpp11BracedListStyle : true
BreakBeforeBinaryOperators : None

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: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ project(RAJA LANGUAGES CXX C
VERSION ${RAJA_LOADED})

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/thirdparty" ${CMAKE_MODULE_PATH})

set(BLT_REQUIRED_CLANGFORMAT_VERSION "14" CACHE STRING "")
include(cmake/SetupRajaOptions.cmake)

cmake_minimum_required(VERSION 3.23)
Expand Down Expand Up @@ -136,6 +136,9 @@ include(cmake/SetupCompilers.cmake)
# Macros for building executables and libraries
include (cmake/RAJAMacros.cmake)

# Configure `style` target for enforcing code style
raja_add_code_checks()

set (raja_sources
src/AlignedRangeIndexSetBuilders.cpp
src/DepGraphNode.cpp
Expand Down
Loading
Loading