From f34f5a67be8cfc436a0dd7bdb2e15b3d3a0d6617 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 21 Oct 2024 12:19:23 +0200 Subject: [PATCH] Update clang-format config, exclude vendored files --- .clang-format | 11 +++++++---- cmake/clang-tools.cmake | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.clang-format b/.clang-format index b8c919762..5eb2af94c 100644 --- a/.clang-format +++ b/.clang-format @@ -20,7 +20,7 @@ AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: false BinPackArguments: false BinPackParameters: false -BraceWrapping: +BraceWrapping: AfterClass: false AfterControlStatement: false AfterEnum: false @@ -35,7 +35,7 @@ BraceWrapping: BreakBeforeBinaryOperators: None BreakBeforeBraces: Attach BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true ColumnLimit: 80 @@ -48,7 +48,7 @@ DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeCategories: +IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 - Regex: '^(<|"(gtest|isl|json)/)' @@ -75,7 +75,10 @@ PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right +PointerAlignment: Left +QualifierAlignment: Custom +QualifierOrder: ['inline', 'static', 'type', 'const'] +ReferenceAlignment: Left ReflowComments: true SortIncludes: true SpaceAfterCStyleCast: false diff --git a/cmake/clang-tools.cmake b/cmake/clang-tools.cmake index 528e9503b..92fc03388 100644 --- a/cmake/clang-tools.cmake +++ b/cmake/clang-tools.cmake @@ -4,7 +4,7 @@ execute_process( COMMAND sh -c - "git ls-tree -r HEAD --name-only | grep -E '(\\.cpp$)|(\\.h$)' | tr '\n' ' '" + "git ls-tree -r HEAD --name-only | grep -E '(\\.cpp$)|(\\.h$)' | grep -v '^deps/' | grep -v '^ThirdParty/' | tr '\n' ' '" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE ALL_CXX_SOURCE_FILES)