diff --git a/.clang-format b/.clang-format index 267ddb0a4f..5ae36afdd8 100644 --- a/.clang-format +++ b/.clang-format @@ -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 @@ -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 @@ -46,26 +69,26 @@ 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 @@ -73,8 +96,8 @@ ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH -StatementAttributeLikeMacros: - - Q_EMIT +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Preserve IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' @@ -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 @@ -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 ... diff --git a/clam-format b/clam-format index e0cb2e76c0..f063eaa0e7 100755 --- a/clam-format +++ b/clam-format @@ -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"` diff --git a/libclambcc/ClamBCAnalyzer/ClamBCAnalyzer.h b/libclambcc/ClamBCAnalyzer/ClamBCAnalyzer.h index 9f6955c0e8..a9a7930769 100644 --- a/libclambcc/ClamBCAnalyzer/ClamBCAnalyzer.h +++ b/libclambcc/ClamBCAnalyzer/ClamBCAnalyzer.h @@ -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: @@ -266,4 +266,4 @@ class ClamBCAnalyzer : public llvm::AnalysisInfoMixin } }; -#endif //CLAMBC_ANALYZER_H_ +#endif // CLAMBC_ANALYZER_H_ diff --git a/libclambcc/ClamBCChangeMallocArgSize/ClamBCChangeMallocArgSize.cpp b/libclambcc/ClamBCChangeMallocArgSize/ClamBCChangeMallocArgSize.cpp index da1e5b7f37..7b3dcb868f 100644 --- a/libclambcc/ClamBCChangeMallocArgSize/ClamBCChangeMallocArgSize.cpp +++ b/libclambcc/ClamBCChangeMallocArgSize/ClamBCChangeMallocArgSize.cpp @@ -65,7 +65,7 @@ class ChangeMallocArgSize : public PassInfoMixin } } - /* 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. */ diff --git a/libclambcc/ClamBCExtendPHIsTo64Bit/ClamBCExtendPHIsTo64Bit.cpp b/libclambcc/ClamBCExtendPHIsTo64Bit/ClamBCExtendPHIsTo64Bit.cpp index 614d30e16c..0885e1598a 100644 --- a/libclambcc/ClamBCExtendPHIsTo64Bit/ClamBCExtendPHIsTo64Bit.cpp +++ b/libclambcc/ClamBCExtendPHIsTo64Bit/ClamBCExtendPHIsTo64Bit.cpp @@ -103,7 +103,7 @@ class ClamBCExtendPHIsTo64Bit : public PassInfoMixin 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(i)) { continue; } diff --git a/libclambcc/ClamBCLogicalCompiler/ClamBCLogicalCompiler.cpp b/libclambcc/ClamBCLogicalCompiler/ClamBCLogicalCompiler.cpp index 83e48453fd..013dff694b 100644 --- a/libclambcc/ClamBCLogicalCompiler/ClamBCLogicalCompiler.cpp +++ b/libclambcc/ClamBCLogicalCompiler/ClamBCLogicalCompiler.cpp @@ -206,8 +206,8 @@ class LogicalNode : public FoldingSetNode if (Node->kind == LOG_ADD) { ConstantRange Cmp(APInt(32, value)); // a + c < b -> a+c in [0, b) -> a in [0-c, b-c) - /*TODO: Determine if makeSatisfyingICmpRegin is better than makeAllowedICmpRegion, - * If this is changed, check the rest.*/ + /*TODO: Determine if makeSatisfyingICmpRegin is better than makeAllowedICmpRegion, + * If this is changed, check the rest.*/ ConstantRange ltRange = ConstantRange::makeSatisfyingICmpRegion(CmpInst::ICMP_ULT, Cmp); ltRange = ltRange.subtract(APInt(32, Node->op0)); @@ -328,9 +328,9 @@ class LogicalNode : public FoldingSetNode } /* - * aragusa: All this is doing is checking for duplicates in whatever collection begin and end reference. - * Why are we putting them in another local? - * */ + * aragusa: All this is doing is checking for duplicates in whatever collection begin and end reference. + * Why are we putting them in another local? + * */ bool checkUniq() { LogicalSet nodes; @@ -604,7 +604,7 @@ class LogicalCompiler } CI = cast(CE->getOperand(2)); } else { - /* In this case, we are directly loading the global, + /* In this case, we are directly loading the global, * instead of using a getelementptr. * It is likely that this would have been changed by O3. */ @@ -756,8 +756,8 @@ class LogicalCompiler if (BranchInst *bi = llvm::dyn_cast(curr->getTerminator())) { if (bi->isConditional()) { - //copy the route, so that there are separate paths for the true - //and false condition. + // copy the route, so that there are separate paths for the true + // and false condition. std::vector route; for (size_t i = 0; i < routes[idx].size(); i++) { route.push_back(new LogicalPHIHelper(routes[idx][i])); @@ -896,7 +896,7 @@ class LogicalCompiler for (size_t j = 0; j < idxs.size(); j++) { size_t idx = idxs[j]; LogicalNode *tmp = getLogicalNode(routes[idx]); - if (nullptr == pci) { //Then this isn't a constant + if (nullptr == pci) { // Then this isn't a constant LogicalNode *l = Map.find(vIncoming)->second; tmp = LogicalNode::getAnd(tmp, l); } @@ -976,7 +976,7 @@ class LogicalCompiler * * We are going to handle these cases by only adding an 'and' or an 'or' if there is * an actual logical operation, not for constants. - * + * entry: %0 = load i32, ptr @__clambc_match_counts, align 16 @@ -1391,7 +1391,7 @@ static bool checkMinimum(llvm::Module *M, std::string s, unsigned min, unsigned ref.find("VI") != StringRef::npos) { min_required = FUNC_LEVEL_096_dev; msgreq = "Logical signature use of VI/macros requires minimum " - "functionality level of FUNC_LEVEL_096_dev"; + "functionality level of FUNC_LEVEL_096_dev"; } if (kind >= BC_PDF) { @@ -1411,21 +1411,21 @@ static bool checkMinimum(llvm::Module *M, std::string s, unsigned min, unsigned pos < ref.size() && ref[pos] != '0') { min_recommended = FUNC_LEVEL_096_2; msgrec = "Logical signature use of count comparison " - "requires minimum functionality level of FUNC_LEVEL_096_2 (bb #2053)"; + "requires minimum functionality level of FUNC_LEVEL_096_2 (bb #2053)"; break; } } if (min_recommended < FUNC_LEVEL_096_4) { min_recommended = FUNC_LEVEL_096_4; msgrec = "FUNC_LEVEL_096_4 is minimum recommended engine version. Older " - "versions have quadratic load time"; + "versions have quadratic load time"; } /*JSON CHECK*/ if (hasJSONUsage(M)) { min_required = FUNC_LEVEL_098_5; msgreq = "JSON reading API requires minimum functionality level " - "of FUNC_LEVEL_098_5"; + "of FUNC_LEVEL_098_5"; } /*JSON CHECK*/ @@ -1546,11 +1546,11 @@ bool ClamBCLogicalCompiler::compileLogicalSignature(Function &F, unsigned target if (min || max || !icon1.empty() || !icon2.empty()) { if (!max) max = 255; /* for now it should be enough, we can always increase it later - */ + */ if (!min) min = FUNC_LEVEL_096_4; /* 0.96 is first to have bytecode support, but <0.96.4 has quadratic load - * time */ + * time */ LogicalSignature = LogicalSignature + (";Engine:" + Twine(min) + "-" + Twine(max) + ",").str(); } else diff --git a/libclambcc/ClamBCLogicalCompilerHelper/ClamBCLogicalCompilerHelper.cpp b/libclambcc/ClamBCLogicalCompilerHelper/ClamBCLogicalCompilerHelper.cpp index b2b43050ed..27a33b6db2 100644 --- a/libclambcc/ClamBCLogicalCompilerHelper/ClamBCLogicalCompilerHelper.cpp +++ b/libclambcc/ClamBCLogicalCompilerHelper/ClamBCLogicalCompilerHelper.cpp @@ -58,7 +58,7 @@ * we are going to undo the PHI nodes added by O3 that would have to * * - * Consider the code + * Consider the code return.sink.split: ; preds = %if.end39, %for.end %.str.1.sink = phi ptr [ @.str, %for.end ], [ @.str.1, %if.end39 ] @@ -119,9 +119,9 @@ size_t ClamBCLogicalCompilerHelper::getBranchIdx(llvm::BranchInst *pBranch, llvm } /* - * Add calls to setvirusname for each constant string, rather allowing a phinode to - * choose the string. This is a requirement for ClamBCLogicalCompiler. - */ + * Add calls to setvirusname for each constant string, rather allowing a phinode to + * choose the string. This is a requirement for ClamBCLogicalCompiler. + */ void ClamBCLogicalCompilerHelper::processPHI(PHINode *phi, Function *pCalledFunction, std::vector &args) { @@ -135,7 +135,7 @@ void ClamBCLogicalCompilerHelper::processPHI(PHINode *phi, Function *pCalledFunc it is a predecessor block to my phi node, so no need for a dyn_cast*/ - size_t branchIdx = getBranchIdx(pBranch, phi->getParent()); + size_t branchIdx = getBranchIdx(pBranch, phi->getParent()); BasicBlock *pNew = BasicBlock::Create(pMod->getContext(), "ClamBCLogicalCompilerHelper_call_SetVirusName_", phi->getParent()->getParent(), phi->getParent()); @@ -149,9 +149,9 @@ void ClamBCLogicalCompilerHelper::processPHI(PHINode *phi, Function *pCalledFunc } /* - * Find all calls to setvirusname, and make sure they aren't loading the - * first argument from a variable. - */ + * Find all calls to setvirusname, and make sure they aren't loading the + * first argument from a variable. + */ void ClamBCLogicalCompilerHelper::fixupSetVirusNameCalls() { diff --git a/libclambcc/ClamBCLowering/ClamBCLowering.cpp b/libclambcc/ClamBCLowering/ClamBCLowering.cpp index da63d44f99..2df1cbebb2 100644 --- a/libclambcc/ClamBCLowering/ClamBCLowering.cpp +++ b/libclambcc/ClamBCLowering/ClamBCLowering.cpp @@ -95,7 +95,7 @@ void ClamBCLowering::lowerIntrinsics(IntrinsicLowering *IL, Function &F) if (VSz < 32) { // needs zext, never sext (as index cannot be negative) V2 = Builder.CreateZExtOrBitCast(V, Type::getInt32Ty(C)); - } else if (VSz == 32) { //possible through CastInst path + } else if (VSz == 32) { // possible through CastInst path // pass-through V2 = V; } else { // VSz > 32 @@ -125,7 +125,7 @@ void ClamBCLowering::lowerIntrinsics(IntrinsicLowering *IL, Function &F) GetElementPtrInst *GEP = dyn_cast(PI->getOperand(0)); if (GEP && GEP->getNumOperands() == 2) { Value *V1 = GEP->getOperand(1); - //if (GEP->getType()->getElementType() == Type::getInt8Ty(F.getContext())) { + // if (GEP->getType()->getElementType() == Type::getInt8Ty(F.getContext())) { if (GEP->getSourceElementType() == Type::getInt8Ty(F.getContext())) { Value *P0 = Builder.CreatePtrToInt(GEP->getOperand(0), V1->getType()); @@ -316,7 +316,7 @@ static bool replaceIntrinsicCalls(llvm::MemIntrinsic *pMemIntrinsic, std::pairgetCalledFunction(); { if (rep.first == pCalled) { - //llvm::CallSite CS(MI); + // llvm::CallSite CS(MI); Value *Len = pMemIntrinsic->getArgOperand(2); llvm::Value *newLen = getReplacementSizeOperand(pMemIntrinsic, Len); @@ -334,7 +334,7 @@ static bool replaceIntrinsicCalls(llvm::MemIntrinsic *pMemIntrinsic, std::pair &allocas) { for (auto i = bb->begin(), e = bb->end(); i != e; i++) { @@ -384,10 +384,10 @@ static void gatherAllocasWithBitcasts(llvm::BasicBlock *bb, std::vector [#uses=1] - * %base_gepz = getelementptr [264 x i8]* %0, i32 0, i32 0 ; [#uses=3] + * %base_gepz = getelementptr [264 x i8]* %0, i32 0, i32 0 ; [#uses=3] * %bcastrr = bitcast i8* %base_gepz to [264 x i8]* ; <[264 x i8]*> [#uses=2] * ... - * %18 = bitcast [264 x i8]* %bcastrr to i8* ; [#uses=0] + * %18 = bitcast [264 x i8]* %bcastrr to i8* ; [#uses=0] * %call133 = call i32 @rc4_stream_setup(i8* %base_gepz, i32 264, i8* %base_gepz22, i32 32) ; [#uses=1] * */ @@ -498,7 +498,7 @@ void ClamBCLowering::fixupPtrToInts(Function &F) for (std::vector::iterator I = insts.begin(), E = insts.end(); I != E; ++I) { PtrToIntInst *PI = *I; - //Builder.SetInsertPoint(PI->getParent(), PI); + // Builder.SetInsertPoint(PI->getParent(), PI); Builder.SetInsertPoint(PI); Value *PI2 = Builder.CreatePtrToInt(PI->getOperand(0), I64Ty); Value *R = Builder.CreateTrunc(PI2, I32Ty); diff --git a/libclambcc/ClamBCLowering/ClamBCLowering.h b/libclambcc/ClamBCLowering/ClamBCLowering.h index c1f80327e4..86e3550e10 100644 --- a/libclambcc/ClamBCLowering/ClamBCLowering.h +++ b/libclambcc/ClamBCLowering/ClamBCLowering.h @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ -//#define DEBUG_TYPE "bclowering" +// #define DEBUG_TYPE "bclowering" #include #include diff --git a/libclambcc/ClamBCOutlineEndiannessCalls/ClamBCOutlineEndiannessCalls.cpp b/libclambcc/ClamBCOutlineEndiannessCalls/ClamBCOutlineEndiannessCalls.cpp index b3449fe530..ccaffa1687 100644 --- a/libclambcc/ClamBCOutlineEndiannessCalls/ClamBCOutlineEndiannessCalls.cpp +++ b/libclambcc/ClamBCOutlineEndiannessCalls/ClamBCOutlineEndiannessCalls.cpp @@ -73,8 +73,8 @@ class ClamBCOutlineEndiannessCalls : public PassInfoMixinaddFnAttr(Attribute::OptimizeNone); pNew->addFnAttr(Attribute::NoInline); - //TODO: Test with NoInline, but not OptimizeNone (Hopefully I can have the function return 1 or 0, and - //not have to actually call the function. + // TODO: Test with NoInline, but not OptimizeNone (Hopefully I can have the function return 1 or 0, and + // not have to actually call the function. return pNew; } diff --git a/libclambcc/ClamBCRebuild/ClamBCRebuild.cpp b/libclambcc/ClamBCRebuild/ClamBCRebuild.cpp index 2b83c21c89..e0f1ed0692 100644 --- a/libclambcc/ClamBCRebuild/ClamBCRebuild.cpp +++ b/libclambcc/ClamBCRebuild/ClamBCRebuild.cpp @@ -95,7 +95,7 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitor(&*I)) { PHINode *PN = dyn_cast(VMap[N]); @@ -264,7 +264,7 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitor(Ty)) { Ty = ATy->getElementType(); - //TODO: check for overflow + // TODO: check for overflow n *= ATy->getNumElements(); } if (n != 1) @@ -275,7 +275,7 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitor, public InstVisitorGetInsertPoint(); BasicBlock *targetBB = I->getParent(); if (thisBB != targetBB) { - //BasicBlock::iterator IP = I; + // BasicBlock::iterator IP = I; BasicBlock::iterator IP(I); ++IP; while (isa(IP)) ++IP; @@ -397,10 +397,10 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitorgetType() != op1->getType()) { if (isa(op0)) op0 = makeCast(op0, op1->getType()); @@ -431,7 +431,7 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitor, public InstVisitorCreateInBoundsGEP(P, idxs.begin(), idxs.end()); + // P = Builder->CreateInBoundsGEP(P, idxs.begin(), idxs.end()); P = Builder->CreateInBoundsGEP(pt, P, idxs, "clambcRebuildInboundsGEP"); } else { - //P = Builder->CreateGEP(P, idxs.begin(), idxs.end()); + // P = Builder->CreateGEP(P, idxs.begin(), idxs.end()); P = Builder->CreateGEP(pt, P, idxs, "clambcRebuildGEP"); } VMap[&II] = makeCast(P, rebuildType(II.getType())); @@ -476,7 +476,7 @@ class ClamBCRebuild : public PassInfoMixin, public InstVisitorCreatePHI(I.getType(), 0, "ClamBCRebuild_phi_visitPHINode_"); - //2nd phase will map the operands + // 2nd phase will map the operands } void visitCastInst(CastInst &I) diff --git a/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.cpp b/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.cpp index 38ae1d076e..301e021460 100644 --- a/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.cpp +++ b/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.cpp @@ -57,7 +57,7 @@ void ClamBCRegAllocAnalysis::handlePHI(PHINode *PN) BasicBlock *pEntry = llvm::cast(pFunc->begin()); Instruction *pFirst = llvm::cast(pEntry->begin()); AllocaInst *AI = new AllocaInst(PN->getType(), pFunc->getAddressSpace(), ".phi", - pFirst); + pFirst); llvm::IRBuilder<> builder(PN->getContext()); unsigned MDDbgKind = PN->getContext().getMDKindID("dbg"); if (MDDbgKind) { @@ -194,9 +194,9 @@ bool ClamBCRegAllocAnalysis::runOnFunction(Function &F) } ++id; } - //TODO: reduce the number of virtual registers used, by using - // an algorithms that walks the dominatortree and does value liveness - // analysis. + // TODO: reduce the number of virtual registers used, by using + // an algorithms that walks the dominatortree and does value liveness + // analysis. return Changed; } diff --git a/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.h b/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.h index 7777ce79bc..8e76d914a4 100644 --- a/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.h +++ b/libclambcc/ClamBCRegAlloc/ClamBCRegAlloc.h @@ -109,4 +109,4 @@ class ClamBCRegAllocAnalyzer : public llvm::AnalysisInfoMixin { protected: Module *pMod = nullptr; diff --git a/libclambcc/ClamBCRemoveFreezeInsts/ClamBCRemoveFreezeInsts.cpp b/libclambcc/ClamBCRemoveFreezeInsts/ClamBCRemoveFreezeInsts.cpp index a58b2516c9..ea10ef8e7b 100644 --- a/libclambcc/ClamBCRemoveFreezeInsts/ClamBCRemoveFreezeInsts.cpp +++ b/libclambcc/ClamBCRemoveFreezeInsts/ClamBCRemoveFreezeInsts.cpp @@ -38,7 +38,7 @@ using namespace std; namespace { /* - * Freeze Instructions are to guarantee sane behaviour in the case of undefs or poison values. The interpreter + * Freeze Instructions are to guarantee sane behaviour in the case of undefs or poison values. The interpreter * has no notion of freeze instructions, so we are removing them. The verifier will fail if there are undef or * poison values in the IR, so this is safe to do. */ diff --git a/libclambcc/ClamBCRemovePointerPHIs/ClamBCRemovePointerPHIs.cpp b/libclambcc/ClamBCRemovePointerPHIs/ClamBCRemovePointerPHIs.cpp index 26af45e0cf..b84e7bf4ed 100644 --- a/libclambcc/ClamBCRemovePointerPHIs/ClamBCRemovePointerPHIs.cpp +++ b/libclambcc/ClamBCRemovePointerPHIs/ClamBCRemovePointerPHIs.cpp @@ -77,9 +77,9 @@ class ClamBCRemovePointerPHIs : public PassInfoMixin if (1 != vals.size()) { /* - * This may not be an issue, but want to investigate it. - * This would be due to the phi node not being the same base pointer with a different index. - */ + * This may not be an issue, but want to investigate it. + * This would be due to the phi node not being the same base pointer with a different index. + */ return nullptr; } else { @@ -197,15 +197,15 @@ class ClamBCRemovePointerPHIs : public PassInfoMixin for (size_t i = 0; i < pn->getNumIncomingValues(); i++) { Value *incoming = getOrigValue(pn->getIncomingValue(i)); - //If this value is dependent on the phi node, then it cannot - //be what the PHINode was initialized to the first time the - //block was entered, which is what we are looking for. + // If this value is dependent on the phi node, then it cannot + // be what the PHINode was initialized to the first time the + // block was entered, which is what we are looking for. if (not(phiIsDependent(incoming, pn))) { continue; } if (GetElementPtrInst *p = llvm::dyn_cast(pn->getIncomingValue(i))) { - //Replace initValue with the index operand of the GetElementPtrInst here. + // Replace initValue with the index operand of the GetElementPtrInst here. for (auto idx = p->idx_begin(), idxe = p->idx_end(); idx != idxe; idx++) { initValue = llvm::cast(idx); } diff --git a/libclambcc/ClamBCRemoveUSUB/ClamBCRemoveUSUB.cpp b/libclambcc/ClamBCRemoveUSUB/ClamBCRemoveUSUB.cpp index 976d8f81b5..5620863929 100644 --- a/libclambcc/ClamBCRemoveUSUB/ClamBCRemoveUSUB.cpp +++ b/libclambcc/ClamBCRemoveUSUB/ClamBCRemoveUSUB.cpp @@ -66,16 +66,16 @@ struct ClamBCRemoveUSUB : public PassInfoMixin { BasicBlock *pRHS = BasicBlock::Create(pMod->getContext(), "right", usub); BasicBlock *pRetBlock = BasicBlock::Create(pMod->getContext(), "ret", usub); - //entry block + // entry block AllocaInst *retVar = new AllocaInst(functionArgType, addressSpace, "ret", pEntry); ICmpInst *cmp = new ICmpInst(*pEntry, CmpInst::ICMP_UGT, pLeft, pRight, "icmp"); BranchInst::Create(pLHS, pRHS, cmp, pEntry); - //left > right + // left > right new StoreInst(BinaryOperator::Create(Instruction::Sub, pLeft, pRight, "ClamBCRemoveUSUB_", pLHS), retVar, pLHS); BranchInst::Create(pRetBlock, pLHS); - //right >= left + // right >= left new StoreInst(ConstantInt::get(functionArgType, 0), retVar, pRHS); BranchInst::Create(pRetBlock, pRHS); diff --git a/libclambcc/ClamBCRemoveUndefs/ClamBCRemoveUndefs.cpp b/libclambcc/ClamBCRemoveUndefs/ClamBCRemoveUndefs.cpp index 5f5ed29502..7ec7c9a4d6 100644 --- a/libclambcc/ClamBCRemoveUndefs/ClamBCRemoveUndefs.cpp +++ b/libclambcc/ClamBCRemoveUndefs/ClamBCRemoveUndefs.cpp @@ -21,10 +21,10 @@ using namespace llvm; namespace { /* - * This pass requires -mem2reg before it (TEMPORARILY) - * and must be run before -O3. + * This pass requires -mem2reg before it (TEMPORARILY) + * and must be run before -O3. * - * This will remove storing parameters in stack variables and loading from there. + * This will remove storing parameters in stack variables and loading from there. * * ; Function Attrs: noinline nounwind uwtable define dso_local i32 @decrypt_config(i32 %config_location, %struct._state* %state, i32 %sizeof_state) #0 { diff --git a/libclambcc/ClamBCRemoveUnsupportedICMPIntrinsics/ClamBCRemoveUnsupportedICMPIntrinsics.cpp b/libclambcc/ClamBCRemoveUnsupportedICMPIntrinsics/ClamBCRemoveUnsupportedICMPIntrinsics.cpp index 4ede0dc0a4..b7b5576fed 100644 --- a/libclambcc/ClamBCRemoveUnsupportedICMPIntrinsics/ClamBCRemoveUnsupportedICMPIntrinsics.cpp +++ b/libclambcc/ClamBCRemoveUnsupportedICMPIntrinsics/ClamBCRemoveUnsupportedICMPIntrinsics.cpp @@ -43,7 +43,7 @@ namespace struct ClamBCRemoveUnsupportedICMPIntrinsics : public PassInfoMixin { protected: Module *pMod = nullptr; - //const char * const UnsupportedICMPIntrinsics_NAME = ".smin"; + // const char * const UnsupportedICMPIntrinsics_NAME = ".smin"; FunctionType *sminType = nullptr; @@ -69,16 +69,16 @@ struct ClamBCRemoveUnsupportedICMPIntrinsics : public PassInfoMixingetContext(), "right", smin); BasicBlock *pRetBlock = BasicBlock::Create(pMod->getContext(), "ret", smin); - //entry block + // entry block AllocaInst *retVar = new AllocaInst(functionArgType, addressSpace, "ret", pEntry); ICmpInst *cmp = new ICmpInst(*pEntry, predicate, pLeft, pRight, "icmp"); BranchInst::Create(pLHS, pRHS, cmp, pEntry); - //left > right + // left > right new StoreInst(pLeft, retVar, pLHS); BranchInst::Create(pRetBlock, pLHS); - //right >= left + // right >= left new StoreInst(pRight, retVar, pRHS); BranchInst::Create(pRetBlock, pRHS); diff --git a/libclambcc/ClamBCTrace/ClamBCTrace.cpp b/libclambcc/ClamBCTrace/ClamBCTrace.cpp index 0b55884c68..91e9410689 100644 --- a/libclambcc/ClamBCTrace/ClamBCTrace.cpp +++ b/libclambcc/ClamBCTrace/ClamBCTrace.cpp @@ -139,7 +139,7 @@ PreservedAnalyses ClamBCTrace::run(Module &M, ModuleAnalysisManager &MAM) DILocation *Loc = II->getDebugLoc(); StringRef file = Loc->getFilename(); Value *File = builder.CreateGlobalStringPtr(file.str().c_str()); - /*just getting this to compile, so i can iterate the MDNode's in the Instruction, + /*just getting this to compile, so i can iterate the MDNode's in the Instruction, * and see which one i want. */ MDNode *NewScope = nullptr; @@ -154,19 +154,19 @@ PreservedAnalyses ClamBCTrace::run(Module &M, ModuleAnalysisManager &MAM) DIScope *scope = Loc->getScope(); while (llvm::isa(scope)) { DILexicalBlock *lex = llvm::cast(scope); - //scope = lex->getContext(); + // scope = lex->getContext(); scope = lex->getScope(); } Value *Scope = 0; if (llvm::isa(scope)) { DISubprogram *sub = llvm::cast(scope); - //StringRef name = sub->getDisplayName(); - //if (name.empty()) name = sub->getName(); + // StringRef name = sub->getDisplayName(); + // if (name.empty()) name = sub->getName(); StringRef name = sub->getName(); Scope = builder.CreateGlobalStringPtr(name.str().c_str()); } else { - //assert(scope->isCompileUnit()); + // assert(scope->isCompileUnit()); assert(llvm::isa(scope) && "Not a DICompileUnit"); DICompileUnit *unit = llvm::cast(scope); Scope = @@ -197,7 +197,7 @@ PreservedAnalyses ClamBCTrace::run(Module &M, ModuleAnalysisManager &MAM) if (isa(AI->getType())) { } else if (isa(AI->getType())) { Value *V = builder.CreatePointerCast(AI, - PointerType::getUnqual(Type::getInt8Ty(M.getContext()))); + PointerType::getUnqual(Type::getInt8Ty(M.getContext()))); std::vector args = { V, ConstantInt::get(Type::getInt32Ty(M.getContext()), 0)}; builder.CreateCall(trace_ptr, args, "ClamBCTrace_trace_ptr"); diff --git a/libclambcc/ClamBCVerifier/ClamBCVerifier.cpp b/libclambcc/ClamBCVerifier/ClamBCVerifier.cpp index 3102c1b8e6..1727df921b 100644 --- a/libclambcc/ClamBCVerifier/ClamBCVerifier.cpp +++ b/libclambcc/ClamBCVerifier/ClamBCVerifier.cpp @@ -21,7 +21,7 @@ */ /* - * aragusa: + * aragusa: * I haven't looked into everything this pass does, but one thing I have found is that it inserts run-time bounds * checking for pointers. What it does is look at the access to a pointer, and insert a check for if that will * access too much memory. If it would, it jumps to an "AbortBB", a basic block that calls abort. One potential @@ -139,7 +139,7 @@ class ClamBCVerifier : public PassInfoMixin, } /* - * FreezeInst's are used to guarantee a value being set to something fixed + * FreezeInst's are used to guarantee a value being set to something fixed * if it is undef or a poison value. They are a noop otherwise, so we will allow * them in the verifier, and remove them in a pass to be run after the verifier. * (a 'verifier' shouldn't be changing the IR). @@ -367,7 +367,7 @@ class ClamBCVerifier : public PassInfoMixin, AU.setPreservesAll(); } }; -//char ClamBCVerifier::ID = 0; +// char ClamBCVerifier::ID = 0; } // namespace ClamBCVerifier diff --git a/libclambcc/ClamBCWriter/ClamBCWriter.cpp b/libclambcc/ClamBCWriter/ClamBCWriter.cpp index 3ec9e74526..1a2d33c8e9 100644 --- a/libclambcc/ClamBCWriter/ClamBCWriter.cpp +++ b/libclambcc/ClamBCWriter/ClamBCWriter.cpp @@ -64,8 +64,8 @@ extern "C" const char *clambc_getversion(void); -//There were some things that were in the previous Module, that may or may not be needed at this time. There -//are ways to share data between passes, will do that if it is necessary. +// There were some things that were in the previous Module, that may or may not be needed at this time. There +// are ways to share data between passes, will do that if it is necessary. using namespace llvm; @@ -113,12 +113,12 @@ class ClamBCOutputWriter if (nullptr == fro) { assert(0 && "FIGURE OUT THE CORRECT WAY TO DIE"); - //ClamBCStop(); + // ClamBCStop(); } ClamBCOutputWriter *ret = new ClamBCOutputWriter(*fro, pMod, pAnalyzer); if (nullptr == ret) { assert(0 && "FIGURE OUT THE CORRECT WAY TO DIE"); - //ClamBCStop(); + // ClamBCStop(); } return ret; } @@ -206,7 +206,7 @@ class ClamBCOutputWriter // Bytecode compile timestamp time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - //printNumber(now, false); //IT APPEARS THAT I NEED THIS??? + // printNumber(now, false); //IT APPEARS THAT I NEED THIS??? printNumber(OutReal, now, false); const char *user = getenv("SIGNDUSER"); @@ -272,7 +272,7 @@ class ClamBCOutputWriter Type *Ty = STy->getTypeAtIndex(i); if (isa(Ty)) { - //WriteTypeSymbolic(errs(), STy, M); + // WriteTypeSymbolic(errs(), STy, M); assert(0 && "Find replacement for WriteTypeSymbolic"); STy->dump(); @@ -378,7 +378,7 @@ class ClamBCOutputWriter } return; } - //TODO: better diagnostics here + // TODO: better diagnostics here if (isa(C)) { ClamBCStop("Floating point constants are not supported!", &M); } @@ -416,7 +416,7 @@ class ClamBCOutputWriter unsigned tid = pAnalyzer->getStartTID(); const std::vector &extraTypes = pAnalyzer->getExtraTypes(); for (auto I = extraTypes.begin(), E = extraTypes.end(); I != E; ++I) { - //assert(typeIDs[*I] == tid && "internal type ID mismatch"); + // assert(typeIDs[*I] == tid && "internal type ID mismatch"); assert(pAnalyzer->getTypeID(*I) == tid && "internal type ID mismatch"); describeType(Out, *I, pMod, pAnalyzer); tid++; @@ -536,11 +536,11 @@ class ClamBCOutputWriter void finished(llvm::Module *pMod, ClamBCAnalysis *pAnalyzer) { - //maxline+1, 1 more for \0 + // maxline+1, 1 more for \0 printModuleHeader(*pMod, pAnalyzer, maxLineLength + 1); OutReal << Out.str(); - //MemoryBuffer *MB = nullptr; + // MemoryBuffer *MB = nullptr; const char *start = NULL; std::string copyright = pAnalyzer->getCopyright(); if (copyright.length()) { @@ -551,17 +551,17 @@ class ClamBCOutputWriter SrcFile = pMod->getSourceFileName(); } if (!SrcFile.empty()) { - //std::string ErrStr; - //MB = MemoryBuffer::getFile(SrcFile, &ErrStr); + // std::string ErrStr; + // MB = MemoryBuffer::getFile(SrcFile, &ErrStr); ErrorOr> mbOrErr = MemoryBuffer::getFile(SrcFile); if (std::error_code ec = mbOrErr.getError()) { ClamBCStop("Unable to (re)open input file: " + SrcFile, pMod); } - //MB = mbOrErr.get(); + // MB = mbOrErr.get(); LLVMMemoryBufferRef mbr = wrap(mbOrErr.get().release()); // mapped file is \0 terminated by getFile() start = unwrap(mbr)->getBufferStart(); - //start = MB->getBufferStart(); + // start = MB->getBufferStart(); } } if (!start) { @@ -576,7 +576,7 @@ class ClamBCOutputWriter c = *start++; } while (c == ' ' || c == '\t'); while (c != '\n' && c) { - //char b[3] = {0x60 | (c & 0xf), 0x60 | ((c >> 4) & 0xf), '\0'}; + // char b[3] = {0x60 | (c & 0xf), 0x60 | ((c >> 4) & 0xf), '\0'}; char b[3]; b[0] = 0x60 | (c & 0xf); b[1] = 0x60 | ((c >> 4) & 0xf); @@ -635,7 +635,7 @@ class ClamBCOutputWriter static void printNumber(raw_ostream &Out, uint64_t n, bool constant) { - //llvm::errs() << "printNumber" << "::" << n << "::" << constant << "::"; + // llvm::errs() << "printNumber" << "::" << n << "::" << constant << "::"; char number[32]; unsigned i = 0; while (n > 0) { @@ -648,7 +648,7 @@ class ClamBCOutputWriter number[0] = 0x40 | i; } number[++i] = '\0'; - //llvm::errs() << number << "\n"; + // llvm::errs() << number << "\n"; Out << number; } @@ -674,7 +674,7 @@ class ClamBCOutputWriter Out << "|"; printNumber(Out, len, false); for (i = 0; i < len; i++) { - //char b[3] = {0x60 | (s[i] & 0xf), 0x60 | ((s[i] >> 4) & 0xf), '\0'}; + // char b[3] = {0x60 | (s[i] & 0xf), 0x60 | ((s[i] >> 4) & 0xf), '\0'}; char b[3]; b[0] = 0x60 | (s[i] & 0xf); b[1] = 0x60 | ((s[i] >> 4) & 0xf); @@ -861,7 +861,7 @@ class ClamBCWriter : public PassInfoMixin, public InstVisitorgetFunctionID(&F) == fid && "Function IDs don't match"); FunctionAnalysisManager &fam = pModuleAnalysisManager->getResult(*pMod).getManager(); @@ -964,7 +964,7 @@ class ClamBCWriter : public PassInfoMixin, public InstVisitor\n"; DEBUGERR << *(GEP.getPointerOperand()->getType()) << "\n"; DEBUGERR << iid << "\n"; - //stop("gep1 with type > 65 won't work on interpreter", &GEP); + // stop("gep1 with type > 65 won't work on interpreter", &GEP); assert(0 && "gep1 with type > 65 won't work on interpreter"); } } @@ -1156,7 +1156,7 @@ class ClamBCWriter : public PassInfoMixin, public InstVisitor(I.getType())); if (I.getOpcode() == Instruction::Sub) { // sub ptrtoint, ptrtoint - //TODO: push ptrtoinst through phi nodes! + // TODO: push ptrtoinst through phi nodes! LLVMContext &C = I.getContext(); Instruction *LI = dyn_cast(I.getOperand(0)); Instruction *RI = dyn_cast(I.getOperand(1)); @@ -1272,7 +1272,7 @@ class ClamBCWriter : public PassInfoMixin, public InstVisitorgetType()); @@ -1422,8 +1422,8 @@ bool ClamBCWriter::doInitialization(Module &M) TheModule = &M; if (DumpDI) { - //TODO: Get debug info working. - //Dumper = createDbgInfoPrinterPass(); + // TODO: Get debug info working. + // Dumper = createDbgInfoPrinterPass(); } fid = 0; MDDbgKind = M.getContext().getMDKindID("dbg"); diff --git a/libclambcc/Common/ClamBCDiagnostics.cpp b/libclambcc/Common/ClamBCDiagnostics.cpp index f7323dde9c..4be023f8fc 100644 --- a/libclambcc/Common/ClamBCDiagnostics.cpp +++ b/libclambcc/Common/ClamBCDiagnostics.cpp @@ -181,7 +181,7 @@ static void printMsg(const Twine &Msg, const llvm::Module *M, errs().resetColor(); if (I) { errs() << "\t at : " << *I << "\n"; - //DEBUG(I->getParent()->dump()); + // DEBUG(I->getParent()->dump()); DEBUGERR << *(I->getParent()) << "\n"; ; } diff --git a/libclambcc/Common/bytecode_api.h b/libclambcc/Common/bytecode_api.h index 9d565abe54..0f521eda41 100644 --- a/libclambcc/Common/bytecode_api.h +++ b/libclambcc/Common/bytecode_api.h @@ -73,10 +73,10 @@ enum BytecodeKind { /** specifies a PDF hook, executes at a predetermined point of PDF parsing for PDF files */ BC_PDF, /** specifies a PE hook, executes at a predetermined point in PE parsing for PE files, - * both packed and unpacked files */ + * both packed and unpacked files */ BC_PE_ALL, /** specifies a PRECLASS hook, executes at the end of file property collection and - * operates on the original file targeted for property collection */ + * operates on the original file targeted for property collection */ BC_PRECLASS, /** specifies an ELF unpacker, executed on ELF files on a logical trigger */ BC_ELF_UNPACKER, @@ -90,10 +90,10 @@ enum BytecodeKind { * LibClamAV functionality level constants */ enum FunctionalityLevels { - FUNC_LEVEL_096 = 51, /**< LibClamAV release 0.96.0: bytecode engine released */ - FUNC_LEVEL_096_dev = 52, - FUNC_LEVEL_096_1 = 53, /**< LibClamAV release 0.96.1: logical signature use of VI/macros - * requires this minimum functionality level */ + FUNC_LEVEL_096 = 51, /**< LibClamAV release 0.96.0: bytecode engine released */ + FUNC_LEVEL_096_dev = 52, + FUNC_LEVEL_096_1 = 53, /**< LibClamAV release 0.96.1: logical signature use of VI/macros + * requires this minimum functionality level */ FUNC_LEVEL_096_1_dev = 54, FUNC_LEVEL_096_2 = 54, /**< LibClamAV release 0.96.2: PDF Hooks require this minimum level */ FUNC_LEVEL_096_2_dev = 55, @@ -310,7 +310,7 @@ const uint16_t __clambc_kind; * @param[in] a 0xf00dbeef * @param[in] b 0xbeeff00d * @return 0x12345678 if parameters match, 0x55 otherwise -*/ + */ uint32_t test1(uint32_t a, uint32_t b); /** @@ -588,7 +588,7 @@ uint32_t buffer_pipe_read_avail(int32_t id); * @return pointer to buffer, or NULL if buffer has less than * specified amount */ -//uint8_t *buffer_pipe_read_get(int32_t id, uint32_t amount); +// uint8_t *buffer_pipe_read_get(int32_t id, uint32_t amount); const uint8_t* buffer_pipe_read_get(int32_t id, uint32_t amount); /** @@ -1101,7 +1101,7 @@ uint32_t pdf_getobjsize(int32_t objidx); * @param[in] amount - size returned by pdf_getobjsize (or smaller) * @return NULL - invalid objidx/amount * @return pointer - pointer to original object */ -//uint8_t *pdf_getobj(int32_t objidx, uint32_t amount); +// uint8_t *pdf_getobj(int32_t objidx, uint32_t amount); const uint8_t* pdf_getobj(int32_t objidx, uint32_t amount); /** @@ -1282,9 +1282,9 @@ int32_t json_get_boolean(int32_t objid); */ int32_t json_get_int(int32_t objid); -//int64_t json_get_int64(int32_t objid); +// int64_t json_get_int64(int32_t objid); /* bytecode does not support double type */ -//double json_get_double(int32_t objid); +// double json_get_double(int32_t objid); /* ----------------- END 0.98.4 APIs ---------------------------------- */ /* ----------------- BEGIN 0.101.0 APIs ------------------------------- */ diff --git a/libclambcc/Common/clambc.h b/libclambcc/Common/clambc.h index 3e828bd6f6..f38b9de10a 100644 --- a/libclambcc/Common/clambc.h +++ b/libclambcc/Common/clambc.h @@ -134,7 +134,7 @@ enum bc_global { #ifndef DEBUGERR #define DEBUGERR llvm::errs() << "<" << __FILE__ << "::" << __FUNCTION__ << "::" << __LINE__ << ">" -#endif //DEBUGERR +#endif // DEBUGERR #ifndef DEBUG_WHERE #define DEBUG_WHERE llvm::errs() << "<" << __FUNCTION__ << "::" << __LINE__ << ">\n"