From c4f55fa8774f4dfe53505956b0f5445c05f36516 Mon Sep 17 00:00:00 2001 From: Suraj Shirvankar Date: Mon, 4 Sep 2023 10:44:03 +0200 Subject: [PATCH] Initial style guide clang format implementation --- .clang-format | 192 ++++++++++++++++++++++++++++++++++++++++++ conda/environment.yml | 142 ++++++++++++++++--------------- 2 files changed, 265 insertions(+), 69 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..f18c46f8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,192 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: BlockIndent +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: true + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Allman +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +QualifierAlignment: Leave +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: BinPack +BasedOnStyle: '' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +AllowAllConstructorInitializersOnNextLine: true +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +InsertBraces: true +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Left +PPIndentWidth: -1 +ReferenceAlignment: Middle +ReflowComments: true +RemoveBracesLLVM: false +SeparateDefinitionBlocks: Always +ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + BeforeNonEmptyParentheses: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +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 + diff --git a/conda/environment.yml b/conda/environment.yml index 787c7622..26fa1e24 100644 --- a/conda/environment.yml +++ b/conda/environment.yml @@ -2,72 +2,76 @@ name: riscv_perf_model channels: - conda-forge dependencies: - - _libgcc_mutex>=0.1=conda_forge - - _openmp_mutex>=4.5=2_gnu - - binutils_impl_linux-64>=2.39=he00db2b_1 - - binutils_linux-64>=2.39=h5fc0e48_11 - - boost>=1.76.0=py310h7c3ba0c_1 - - boost-cpp>=1.76.0=h312852a_1 - - bzip2>=1.0.8=h7f98852_4 - - c-ares>=1.18.1=h7f98852_0 - - ca-certificates>=2022.12.7=ha878542_0 - - cmake>=3.19.7 - - cppcheck>=2.7.5=py310h94ea96f_1 - - curl>=7.87.0=h6312ad2_0 - - doxygen>=1.8.20=had0d8f1_0 - - expat>=2.5.0=h27087fc_0 - - gcc_impl_linux-64>=10.4.0=h5231bdf_19 - - gcc_linux-64>=10.4.0=h9215b83_11 - - gxx_impl_linux-64>=10.4.0=h5231bdf_19 - - gxx_linux-64>=10.4.0=h6e491c6_11 - - hdf5>=1.10.6=nompi_h6a2412b_1114 - - icu>=68.2=h9c3ff4c_0 - - kernel-headers_linux-64>=2.6.32=he073ed8_15 - - keyutils>=1.6.1=h166bdaf_0 - - krb5>=1.20.1=hf9c8cef_0 - - ld_impl_linux-64>=2.39=hcc3a1bd_1 - - libblas>=3.9.0=16_linux64_openblas - - libcblas>=3.9.0=16_linux64_openblas - - libcurl>=7.87.0=h6312ad2_0 - - libedit>=3.1.20191231=he28a2e2_2 - - libev>=4.33=h516909a_1 - - libffi>=3.4.2=h7f98852_5 - - libgcc-devel_linux-64>=10.4.0=hd38fd1e_19 - - libgcc-ng>=12.2.0=h65d4601_19 - - libgfortran-ng>=12.2.0=h69a702a_19 - - libgfortran5>=12.2.0=h337968e_19 - - libgomp>=12.2.0=h65d4601_19 - - libiconv>=1.17=h166bdaf_0 - - liblapack>=3.9.0=16_linux64_openblas - - libnghttp2>=1.51.0=hdcd2b5c_0 - - libnsl>=2.0.0=h7f98852_0 - - libopenblas>=0.3.21=pthreads_h78a6416_3 - - libsanitizer>=10.4.0=h5246dfb_19 - - libsqlite>=3.40.0=h753d276_0 - - libssh2>=1.10.0=haa6b8db_3 - - libstdcxx-devel_linux-64>=10.4.0=hd38fd1e_19 - - libstdcxx-ng>=12.2.0=h46fd767_19 - - libuuid>=2.32.1=h7f98852_1000 - - libuv>=1.44.2=h166bdaf_0 - - libzlib>=1.2.13=h166bdaf_4 - - ncurses>=6.3=h27087fc_1 - - numpy>=1.24.1=py310h08bbf29_0 - - openssl>=1.1.1s=h0b41bf4_1 - - pcre>=8.45=h9c3ff4c_0 - - pip>=22.3.1=pyhd8ed1ab_0 - - pygments>=2.11.2=pyhd8ed1ab_0 - - python>=3.10.8=h257c98d_0_cpython - - python_abi>=3.10=3_cp310 - - rapidjson>=1.1.0=he1b5a44_1002 - - readline>=8.1.2=h0f457ee_0 - - rhash>=1.4.3=h166bdaf_0 - - setuptools>=65.6.3=pyhd8ed1ab_0 - - sqlite>=3.36.0=h9cd32fc_2 - - sysroot_linux-64>=2.12=he073ed8_15 - - tk>=8.6.12=h27826a3_0 - - tzdata>=2022g=h191b570_0 - - wheel>=0.38.4=pyhd8ed1ab_0 - - xz>=5.2.6=h166bdaf_0 - - yaml-cpp>=0.7.0=h27087fc_2 - - zlib>=1.2.13=h166bdaf_4 - - zstd>=1.5.2=h6239696_4 + - _libgcc_mutex=0.1=conda_forge + - _openmp_mutex=4.5=2_gnu + - binutils_impl_linux-64=2.39=he00db2b_1 + - binutils_linux-64=2.39=h5fc0e48_11 + - boost=1.82.0=py310h5a539fb_0 + - boost-cpp=1.82.0=h8013b2b_2 + - bzip2=1.0.8=h7f98852_4 + - c-ares=1.18.1=h7f98852_0 + - ca-certificates=2023.7.22=hbcca054_0 + - clang-format-16=16.0.6=default_h1cdf331_1 + - cmake=3.25.2=h077f3f9_0 + - cppcheck=2.7.5=py310h94ea96f_1 + - curl=7.87.0=h6312ad2_0 + - doxygen=1.8.20=had0d8f1_0 + - expat=2.5.0=h27087fc_0 + - gcc_impl_linux-64=10.4.0=h5231bdf_19 + - gcc_linux-64=10.4.0=h9215b83_11 + - gxx_impl_linux-64=10.4.0=h5231bdf_19 + - gxx_linux-64=10.4.0=h6e491c6_11 + - hdf5=1.10.6=nompi_h6a2412b_1114 + - icu=73.2=h59595ed_0 + - kernel-headers_linux-64=2.6.32=he073ed8_15 + - keyutils=1.6.1=h166bdaf_0 + - krb5=1.20.1=hf9c8cef_0 + - ld_impl_linux-64=2.39=hcc3a1bd_1 + - libblas=3.9.0=16_linux64_openblas + - libcblas=3.9.0=16_linux64_openblas + - libclang-cpp16=16.0.6=default_h1cdf331_1 + - libcurl=7.87.0=h6312ad2_0 + - libedit=3.1.20191231=he28a2e2_2 + - libev=4.33=h516909a_1 + - libffi=3.4.2=h7f98852_5 + - libgcc-devel_linux-64=10.4.0=hd38fd1e_19 + - libgcc-ng=12.2.0=h65d4601_19 + - libgfortran-ng=12.2.0=h69a702a_19 + - libgfortran5=12.2.0=h337968e_19 + - libgomp=12.2.0=h65d4601_19 + - libiconv=1.17=h166bdaf_0 + - liblapack=3.9.0=16_linux64_openblas + - libllvm16=16.0.6=h5cf9203_2 + - libnghttp2=1.51.0=hdcd2b5c_0 + - libnsl=2.0.0=h7f98852_0 + - libopenblas=0.3.21=pthreads_h78a6416_3 + - libsanitizer=10.4.0=h5246dfb_19 + - libsqlite=3.40.0=h753d276_0 + - libssh2=1.10.0=haa6b8db_3 + - libstdcxx-devel_linux-64=10.4.0=hd38fd1e_19 + - libstdcxx-ng=12.2.0=h46fd767_19 + - libuuid=2.32.1=h7f98852_1000 + - libuv=1.44.2=h166bdaf_0 + - libxml2=2.11.5=h232c23b_1 + - libzlib=1.2.13=h166bdaf_4 + - ncurses=6.3=h27087fc_1 + - numpy=1.24.1=py310h08bbf29_0 + - openssl=1.1.1v=hd590300_0 + - pcre=8.45=h9c3ff4c_0 + - pip=23.2.1=pyhd8ed1ab_0 + - pygments=2.11.2=pyhd8ed1ab_0 + - python=3.10.8=h257c98d_0_cpython + - python_abi=3.10=3_cp310 + - rapidjson=1.1.0=he1b5a44_1002 + - readline=8.1.2=h0f457ee_0 + - rhash=1.4.3=h166bdaf_0 + - setuptools=68.1.2=pyhd8ed1ab_0 + - sqlite=3.36.0=h9cd32fc_2 + - sysroot_linux-64=2.12=he073ed8_15 + - tk=8.6.12=h27826a3_0 + - tzdata=2022g=h191b570_0 + - wheel=0.41.2=pyhd8ed1ab_0 + - xz=5.2.6=h166bdaf_0 + - yaml-cpp=0.7.0=h27087fc_2 + - zlib=1.2.13=h166bdaf_4 + - zstd=1.5.2=h6239696_4