Skip to content

Commit

Permalink
Formatted with clang-format-16
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Feb 9, 2024
1 parent 3c5556a commit 15b1b64
Show file tree
Hide file tree
Showing 25 changed files with 238 additions and 179 deletions.
123 changes: 91 additions & 32 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,44 @@
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
Expand All @@ -27,17 +49,18 @@ AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
Expand All @@ -46,35 +69,35 @@ BraceWrapping:
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Linux
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Expand All @@ -91,18 +114,30 @@ IncludeCategories:
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
Expand All @@ -112,54 +147,78 @@ ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
SortIncludes: false
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: Never
SortJavaStaticImport: Before
SortUsingDeclarations: true
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

14 changes: 7 additions & 7 deletions clam-format
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

clang-format-12 -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format
clang-format-16 -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format

clang-format-12 -i -verbose `find libclambcc -name "*.cpp"`
clang-format-12 -i -verbose `find libclambcc -name "*.h"`
clang-format-12 -i -verbose `find libclambcc -name "*.c"`
clang-format-16 -i -verbose `find libclambcc -name "*.cpp"`
clang-format-16 -i -verbose `find libclambcc -name "*.h"`
clang-format-16 -i -verbose `find libclambcc -name "*.c"`

clang-format-12 -i -verbose `find examples -name "*.cpp"`
clang-format-12 -i -verbose `find examples -name "*.h"`
clang-format-12 -i -verbose `find examples -name "*.c"`
clang-format-16 -i -verbose `find examples -name "*.cpp"`
clang-format-16 -i -verbose `find examples -name "*.h"`
clang-format-16 -i -verbose `find examples -name "*.c"`
38 changes: 19 additions & 19 deletions libclambcc/ClamBCAnalyzer/ClamBCAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,24 @@ class ClamBCAnalysis
virtual void printGlobals(uint16_t stid);

/* TODO
*
* bytecode_api_decl.c.h
*
* Temporarily did this to populate the api map of the clamav functions that are allowed. Previously,
* there was c++ code that would parse the header file and read in the api's. I am planning on having them
* compiled into the module.
*
* bytecode_api_decl.c.h includes 5 potentially problematic files.
* clamav-types.h => stored in the clamav build directory
* type_desc.h => stored in clamav_checkout/libclamav
* bytecode_api.h => stored in clamav install directory somewhere
* bytecode_api_impl.h => stored in clamav_checkout/libclamav
* bytecode_priv.h => stored in clamav_checkout/libclamav
*
* For NOW, we are just going to hardcode the api map.
*
* Eventually we will have clamav install api headers as part of the build, and just read those.
*/
*
* bytecode_api_decl.c.h
*
* Temporarily did this to populate the api map of the clamav functions that are allowed. Previously,
* there was c++ code that would parse the header file and read in the api's. I am planning on having them
* compiled into the module.
*
* bytecode_api_decl.c.h includes 5 potentially problematic files.
* clamav-types.h => stored in the clamav build directory
* type_desc.h => stored in clamav_checkout/libclamav
* bytecode_api.h => stored in clamav install directory somewhere
* bytecode_api_impl.h => stored in clamav_checkout/libclamav
* bytecode_priv.h => stored in clamav_checkout/libclamav
*
* For NOW, we are just going to hardcode the api map.
*
* Eventually we will have clamav install api headers as part of the build, and just read those.
*/
virtual void populateAPIMap();

public:
Expand Down Expand Up @@ -266,4 +266,4 @@ class ClamBCAnalyzer : public llvm::AnalysisInfoMixin<ClamBCAnalyzer>
}
};

#endif //CLAMBC_ANALYZER_H_
#endif // CLAMBC_ANALYZER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ChangeMallocArgSize : public PassInfoMixin<ChangeMallocArgSize>
}
}

/* Yes, I know there is a "getTerminator" function, but I have come across blocks
/* Yes, I know there is a "getTerminator" function, but I have come across blocks
* that have more than one branch instruction (I think it is a bug in the runtime), but
* until that is resolved, I want to use this function.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ClamBCExtendPHIsTo64Bit : public PassInfoMixin<ClamBCExtendPHIsTo64Bit>
continue;
}

//Not allowed in bytecode sigs, but no reason not to support it.
// Not allowed in bytecode sigs, but no reason not to support it.
if (llvm::isa<LandingPadInst>(i)) {
continue;
}
Expand Down
Loading

0 comments on commit 15b1b64

Please sign in to comment.