1
0
Fork 0

added new clang style and reformat script for clang-format 6.0

This commit is contained in:
Frank Celler 2018-12-26 01:15:34 +01:00
parent 8fab3884a8
commit 2a6add0ca1
4 changed files with 123 additions and 3 deletions

View File

@ -1,4 +1,109 @@
BasedOnStyle: Google
---
Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
Standard: Cpp11
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

View File

@ -32,8 +32,10 @@
// debug malloc for Windows (only used when DEBUG is set)
#define _CRTDBG_MAP_ALLOC
// clang-format off
#include <stdlib.h>
#include <crtdbg.h>
// clang-format on
#ifndef NOMINMAX
#define NOMINMAX
@ -42,8 +44,10 @@
#endif
#define TRI_WITHIN_COMMON 1
// clang-format off
#include "Basics/operating-system.h"
#include "Basics/application-exit.h"
// clang-format on
#undef TRI_WITHIN_COMMON
#include <assert.h>
@ -168,6 +172,7 @@ typedef long suseconds_t;
#include <vector>
#define TRI_WITHIN_COMMON 1
// clang-format off
#include "Basics/voc-errors.h"
#include "Basics/error.h"
#include "Basics/debugging.h"
@ -175,6 +180,7 @@ typedef long suseconds_t;
#include "Basics/memory.h"
#include "Basics/system-compiler.h"
#include "Basics/system-functions.h"
// clang-format on
#undef TRI_WITHIN_COMMON
#ifdef _WIN32

View File

@ -27,10 +27,12 @@
#include "Logger/Logger.h"
#include <velocypack/velocypack-common.h>
#include <velocypack/AttributeTranslator.h>
#include "velocypack/Iterator.h"
#include <velocypack/Iterator.h>
#include <velocypack/Options.h>
#include <velocypack/Slice.h>
#include <velocypack/velocypack-aliases.h>
using namespace arangodb::basics;

7
utils/reformat.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
find arangod arangosh lib enterprise \
-name Zip -prune -o \
-type f "(" -name "*.cpp" -o -name "*.h" ")" \
"!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" | \
xargs clang-format -i -verbose