From 502fecbec6940cc710a209592cbdf178f8a02448 Mon Sep 17 00:00:00 2001 From: Lee James O'Riordan Date: Fri, 8 Dec 2023 15:47:25 -0500 Subject: [PATCH] Update clang-tidy rules for Lightning builds under aarch64 (#567) * Remove redundant CT files * Auto update version * Follow CT recommendation for default constructor * Silence macro warnings * Adjust CT stritness and requirements * Revert classification * Remove redundant options * Remove additional redundant static * Update pennylane_lightning/core/src/utils/RuntimeInfo.cpp * Update pennylane_lightning/core/src/simulators/lightning_qubit/gates/GateIndices.hpp * Update changelog * Auto update version * trigger CI * Auto update version * trigger CI * trigger CI --------- Co-authored-by: Dev version update bot Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Co-authored-by: AmintorDusko --- .github/CHANGELOG.md | 3 + pennylane_lightning/core/_version.py | 2 +- .../core/src/algorithms/tests/.clang-tidy | 233 ------------------ .../core/src/observables/tests/.clang-tidy | 233 ------------------ .../src/simulators/base/tests/.clang-tidy | 233 ------------------ .../algorithms/tests/.clang-tidy | 233 ------------------ .../gates/DynamicDispatcher.hpp | 37 +-- .../lightning_qubit/gates/tests/.clang-tidy | 233 ------------------ .../lightning_qubit/measurements/.clang-tidy | 233 ------------------ .../observables/tests/.clang-tidy | 233 ------------------ .../lightning_qubit/tests/.clang-tidy | 233 ------------------ .../lightning_qubit/utils/Threading.hpp | 3 +- .../lightning_qubit/utils/tests/.clang-tidy | 233 ------------------ .../core/src/utils/CPUMemoryModel.hpp | 17 +- pennylane_lightning/core/src/utils/Error.hpp | 5 +- pennylane_lightning/core/src/utils/Macros.hpp | 4 +- pennylane_lightning/core/src/utils/Memory.hpp | 10 +- .../core/src/utils/RuntimeInfo.cpp | 2 +- .../core/src/utils/RuntimeInfo.hpp | 29 ++- pennylane_lightning/core/src/utils/Util.hpp | 4 +- .../core/src/utils/tests/.clang-tidy | 233 ------------------ 21 files changed, 77 insertions(+), 2369 deletions(-) delete mode 100644 pennylane_lightning/core/src/algorithms/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/observables/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/base/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/gates/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/measurements/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/observables/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/simulators/lightning_qubit/utils/tests/.clang-tidy delete mode 100644 pennylane_lightning/core/src/utils/tests/.clang-tidy diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 70921eca9..00e0cadb9 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -54,6 +54,9 @@ ### Bug fixes +* Allow support for newer clang-tidy versions on non-x86_64 platforms. + [(#567)](https://github.com/PennyLaneAI/pennylane-lightning/pull/567) + * Do not run C++ tests when testing for compatibility with PennyLane, hence fixing plugin-matrix failures. Fix Lightning-GPU workflow trigger. [(#571)](https://github.com/PennyLaneAI/pennylane-lightning/pull/571) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 65bd15d52..299f49a55 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.34.0-dev15" +__version__ = "0.34.0-dev16" diff --git a/pennylane_lightning/core/src/algorithms/tests/.clang-tidy b/pennylane_lightning/core/src/algorithms/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/algorithms/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/observables/tests/.clang-tidy b/pennylane_lightning/core/src/observables/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/observables/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/base/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/base/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/base/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/gates/DynamicDispatcher.hpp b/pennylane_lightning/core/src/simulators/lightning_qubit/gates/DynamicDispatcher.hpp index 8a4a4775e..b6af6a097 100644 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/gates/DynamicDispatcher.hpp +++ b/pennylane_lightning/core/src/simulators/lightning_qubit/gates/DynamicDispatcher.hpp @@ -51,15 +51,17 @@ using Pennylane::Util::PairHash; namespace Pennylane::LightningQubit::Internal { constexpr auto generatorNamesWithoutPrefix() { - constexpr std::string_view prefix = "Generator"; + constexpr std::string_view prefix{"Generator"}; namespace GateConstant = Pennylane::Gates::Constant; std::array, GateConstant::generator_names.size()> - res; + res{}; for (size_t i = 0; i < GateConstant::generator_names.size(); i++) { + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-constant-array-index) const auto [gntr_op, gntr_name] = GateConstant::generator_names[i]; res[i].first = gntr_op; res[i].second = gntr_name.substr(prefix.size()); + // NOLINTEND(cppcoreguidelines-pro-bounds-constant-array-index) } return res; } @@ -101,37 +103,37 @@ template class DynamicDispatcher { using ControlledMatrixFunc = Gates::ControlledMatrixFuncPtrT; private: - std::unordered_map str_to_gates_; + std::unordered_map str_to_gates_{}; std::unordered_map - str_to_controlled_gates_; - std::unordered_map str_to_gntrs_; + str_to_controlled_gates_{}; + std::unordered_map str_to_gntrs_{}; std::unordered_map - str_to_controlled_gntrs_; + str_to_controlled_gntrs_{}; std::unordered_map, GateFunc, PairHash> - gate_kernels_; + gate_kernels_{}; std::unordered_map, GeneratorFunc, PairHash> - generator_kernels_; + generator_kernels_{}; std::unordered_map, MatrixFunc, PairHash> - matrix_kernels_; + matrix_kernels_{}; std::unordered_map, ControlledGateFunc, PairHash> - controlled_gate_kernels_; + controlled_gate_kernels_{}; std::unordered_map, ControlledGeneratorFunc, PairHash> - controlled_generator_kernels_; + controlled_generator_kernels_{}; std::unordered_map, ControlledMatrixFunc, PairHash> - controlled_matrix_kernels_; + controlled_matrix_kernels_{}; - std::unordered_map kernel_names_; + std::unordered_map kernel_names_{}; DynamicDispatcher() { constexpr static auto gntr_names_without_prefix = @@ -435,7 +437,8 @@ template class DynamicDispatcher { * @param gate_op Gate operation * @param kernel Kernel */ - bool isRegistered(GateOperation gate_op, KernelType kernel) const { + [[nodiscard]] bool isRegistered(GateOperation gate_op, + KernelType kernel) const { return gate_kernels_.find(std::make_pair(gate_op, kernel)) != gate_kernels_.cend(); } @@ -460,7 +463,8 @@ template class DynamicDispatcher { * @param gntr_op Generator operation * @param kernel Kernel */ - bool isRegistered(GeneratorOperation gntr_op, KernelType kernel) const { + [[nodiscard]] bool isRegistered(GeneratorOperation gntr_op, + KernelType kernel) const { return generator_kernels_.find(std::make_pair(gntr_op, kernel)) != generator_kernels_.cend(); } @@ -485,7 +489,8 @@ template class DynamicDispatcher { * @param mat_op Matrix operation * @param kernel Kernel */ - bool isRegistered(MatrixOperation mat_op, KernelType kernel) const { + [[nodiscard]] bool isRegistered(MatrixOperation mat_op, + KernelType kernel) const { return matrix_kernels_.find(std::make_pair(mat_op, kernel)) != matrix_kernels_.cend(); } diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/gates/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/gates/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/gates/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/measurements/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/measurements/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/measurements/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/observables/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/observables/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/observables/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/utils/Threading.hpp b/pennylane_lightning/core/src/simulators/lightning_qubit/utils/Threading.hpp index 86e4a1e94..e4f9aa5bb 100644 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/utils/Threading.hpp +++ b/pennylane_lightning/core/src/simulators/lightning_qubit/utils/Threading.hpp @@ -29,6 +29,7 @@ /// @cond DEV namespace { using Pennylane::Util::CPUMemoryModel; +constexpr uint32_t ThreadBitShift = 8U; } // namespace /// @endcond @@ -48,7 +49,7 @@ enum class Threading : uint8_t { constexpr uint32_t toDispatchKey(Threading threading, CPUMemoryModel memory_model) { /* Threading is in higher priority */ - return (static_cast(threading) << 8U) | + return (static_cast(threading) << ThreadBitShift) | static_cast(memory_model); } diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/utils/tests/.clang-tidy b/pennylane_lightning/core/src/simulators/lightning_qubit/utils/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/utils/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... - diff --git a/pennylane_lightning/core/src/utils/CPUMemoryModel.hpp b/pennylane_lightning/core/src/utils/CPUMemoryModel.hpp index a3f45d3ea..66bb6f11e 100644 --- a/pennylane_lightning/core/src/utils/CPUMemoryModel.hpp +++ b/pennylane_lightning/core/src/utils/CPUMemoryModel.hpp @@ -23,6 +23,13 @@ #include #include +namespace { +struct BitWidth { + static constexpr uint32_t b64 = 64U; + static constexpr uint32_t b32 = 32U; +}; +} // namespace + // LCOV_EXCL_START namespace Pennylane::Util { /** @@ -43,13 +50,15 @@ enum class CPUMemoryModel : uint8_t { * @return CPUMemoryModel */ inline auto getMemoryModel(const void *ptr) -> CPUMemoryModel { - if ((reinterpret_cast(ptr) % 64) == 0) { + // NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast) + if ((reinterpret_cast(ptr) % BitWidth::b64) == 0) { return CPUMemoryModel::Aligned512; } - if ((reinterpret_cast(ptr) % 32) == 0) { + if ((reinterpret_cast(ptr) % BitWidth::b32) == 0) { return CPUMemoryModel::Aligned256; } + // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) return CPUMemoryModel::Unaligned; } @@ -86,9 +95,9 @@ template constexpr inline auto getAlignment(CPUMemoryModel memory_model) -> uint32_t { switch (memory_model) { case CPUMemoryModel::Aligned256: - return 32U; + return BitWidth::b32; case CPUMemoryModel::Aligned512: - return 64U; + return BitWidth::b64; default: return alignof(T); } diff --git a/pennylane_lightning/core/src/utils/Error.hpp b/pennylane_lightning/core/src/utils/Error.hpp index 126890743..5cb9c1582 100644 --- a/pennylane_lightning/core/src/utils/Error.hpp +++ b/pennylane_lightning/core/src/utils/Error.hpp @@ -14,6 +14,7 @@ #include #include +// NOLINTBEGIN(cppcoreguidelines-macro-usage) /** * @brief Macro that throws `%LightningException` with given message. * @@ -53,6 +54,8 @@ #define PL_ASSERT(expression) \ PL_ABORT_IF_NOT(expression, "Assertion failed: " #expression) +// NOLINTEND(cppcoreguidelines-macro-usage) + namespace Pennylane::Util { /** * @brief `%LightningException` is the general exception thrown by PennyLane for @@ -61,7 +64,7 @@ namespace Pennylane::Util { */ class LightningException : public std::exception { private: - const std::string err_msg; + std::string err_msg; public: /** diff --git a/pennylane_lightning/core/src/utils/Macros.hpp b/pennylane_lightning/core/src/utils/Macros.hpp index cdfa31428..07674ec61 100644 --- a/pennylane_lightning/core/src/utils/Macros.hpp +++ b/pennylane_lightning/core/src/utils/Macros.hpp @@ -24,10 +24,12 @@ #endif /** * @brief Predefined macro variable to a string. Use std::format instead in - * C++20. + * C++20. TODO: Replace stringify macro definition. */ +// NOLINTBEGIN(cppcoreguidelines-macro-usage) #define PL_TO_STR_INDIR(x) #x #define PL_TO_STR(VAR) PL_TO_STR_INDIR(VAR) +// NOLINTEND(cppcoreguidelines-macro-usage) #if defined(__GNUC__) || defined(__clang__) #define PL_UNREACHABLE __builtin_unreachable() diff --git a/pennylane_lightning/core/src/utils/Memory.hpp b/pennylane_lightning/core/src/utils/Memory.hpp index df69f133d..7796a8cd2 100644 --- a/pennylane_lightning/core/src/utils/Memory.hpp +++ b/pennylane_lightning/core/src/utils/Memory.hpp @@ -22,6 +22,9 @@ #include "TypeList.hpp" namespace Pennylane::Util { +// NOLINTBEGIN(cppcoreguidelines-owning-memory, cppcoreguidelines-no-malloc, +// hicpp-no-malloc) + /** * @brief Custom aligned allocate function. * @@ -62,7 +65,7 @@ inline void alignedFree(void *p) { #elif defined(_MSC_VER) return _aligned_free(p); #else - return std::free(p); // NOLINT(hicpp-no-malloc) + return std::free(p); #endif } @@ -76,6 +79,7 @@ inline void alignedFree(void *p) { */ template class AlignedAllocator { private: + // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) const uint32_t alignment_; public: @@ -114,7 +118,7 @@ template class AlignedAllocator { if (size == 0) { return nullptr; } - void *p; + void *p = nullptr; if (alignment_ > alignof(std::max_align_t)) { p = alignedAlloc(alignment_, sizeof(T) * size); } else { @@ -149,6 +153,8 @@ template class AlignedAllocator { ptr->~U(); } }; +// NOLINTEND(cppcoreguidelines-owning-memory, cppcoreguidelines-no-malloc, +// hicpp-no-malloc) /** * @brief Compare two allocators diff --git a/pennylane_lightning/core/src/utils/RuntimeInfo.cpp b/pennylane_lightning/core/src/utils/RuntimeInfo.cpp index a0814d87a..46d393867 100644 --- a/pennylane_lightning/core/src/utils/RuntimeInfo.cpp +++ b/pennylane_lightning/core/src/utils/RuntimeInfo.cpp @@ -127,6 +127,6 @@ RuntimeInfo::InternalRuntimeInfo::InternalRuntimeInfo() { } } #else -RuntimeInfo::InternalRuntimeInfo::InternalRuntimeInfo(){}; +RuntimeInfo::InternalRuntimeInfo::InternalRuntimeInfo() = default; #endif } // namespace Pennylane::Util diff --git a/pennylane_lightning/core/src/utils/RuntimeInfo.hpp b/pennylane_lightning/core/src/utils/RuntimeInfo.hpp index 8c544ce2a..d77ea6be4 100644 --- a/pennylane_lightning/core/src/utils/RuntimeInfo.hpp +++ b/pennylane_lightning/core/src/utils/RuntimeInfo.hpp @@ -18,6 +18,17 @@ #pragma once #include +namespace { +struct OffsetIndices { + static constexpr int AVX = 28; + static constexpr int AVX2 = 5; + static constexpr int FMA = 12; + static constexpr int AVX512F = 16; +}; +constexpr int BitWidth = 32; + +} // namespace + namespace Pennylane::Util { /** * @brief This class is only usable in x86 or x86_64 architecture. @@ -30,10 +41,10 @@ class RuntimeInfo { std::string vendor{}; std::string brand{}; - std::bitset<32> f_1_ecx{}; - std::bitset<32> f_1_edx{}; - std::bitset<32> f_7_ebx{}; - std::bitset<32> f_7_ecx{}; + std::bitset f_1_ecx{}; + std::bitset f_1_edx{}; + std::bitset f_7_ebx{}; + std::bitset f_7_ecx{}; }; /// @endcond @@ -44,20 +55,18 @@ class RuntimeInfo { public: static inline bool AVX() { - // NOLINTNEXTLINE(readability-magic-numbers) - return getInternalRuntimeInfo().f_1_ecx[28]; + return getInternalRuntimeInfo().f_1_ecx[OffsetIndices::AVX]; } static inline bool AVX2() { - // NOLINTNEXTLINE(readability-magic-numbers) - return getInternalRuntimeInfo().f_7_ebx[5]; + return getInternalRuntimeInfo().f_7_ebx[OffsetIndices::AVX2]; } static inline bool FMA() { // NOLINTNEXTLINE(readability-magic-numbers) - return getInternalRuntimeInfo().f_1_ecx[12]; + return getInternalRuntimeInfo().f_1_ecx[OffsetIndices::FMA]; } static inline bool AVX512F() { // NOLINTNEXTLINE(readability-magic-numbers) - return getInternalRuntimeInfo().f_7_ebx[16]; + return getInternalRuntimeInfo().f_7_ebx[OffsetIndices::AVX512F]; } static const std::string &vendor() { return getInternalRuntimeInfo().vendor; diff --git a/pennylane_lightning/core/src/utils/Util.hpp b/pennylane_lightning/core/src/utils/Util.hpp index c0d0e3d6a..42f6d88ad 100644 --- a/pennylane_lightning/core/src/utils/Util.hpp +++ b/pennylane_lightning/core/src/utils/Util.hpp @@ -89,7 +89,7 @@ inline static constexpr auto ConstSum(std::complex a, std::complex b) * @return constexpr std::complex{0.5,0} */ template inline static constexpr auto HALF() -> std::complex { - return {0.5, 0}; + return {0.5, 0}; // NOLINT(cppcoreguidelines-avoid-magic-numbers) } /** @@ -433,7 +433,7 @@ getIndicesAfterExclusion(const std::vector &indicesToExclude, for (auto j : indicesToExclude) { for (size_t i = 0; i < indices.size(); i++) { if (j == indices[i]) { - indices.erase(indices.begin() + i); + indices.erase(indices.begin() + static_cast(i)); } } } diff --git a/pennylane_lightning/core/src/utils/tests/.clang-tidy b/pennylane_lightning/core/src/utils/tests/.clang-tidy deleted file mode 100644 index 747793823..000000000 --- a/pennylane_lightning/core/src/utils/tests/.clang-tidy +++ /dev/null @@ -1,233 +0,0 @@ ---- -Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-llvmlibc-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-cplusplus*,openmp-*,performance-*,portability-*,readability-*,-modernize-avoid-c-arrays,-readability-magic-numbers,hicpp-*,-hicpp-no-array-decay,-hicpp-avoid-c-arrays,bugprone-suspicious-*,llvm-namespace-comment,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,-readability-identifier-length' -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false -FormatStyle: none -InheritParentConfig: true -User: mlxd -CheckOptions: - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: performance-move-const-arg.CheckTriviallyCopyableMove - value: 'true' - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold - value: '3' - - key: readability-function-size.VariableThreshold - value: '4294967295' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: readability-identifier-naming.GetConfigPerFile - value: 'true' - - key: readability-inconsistent-declaration-parameter-name.Strict - value: 'false' - - key: readability-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: modernize-use-default-member-init.UseAssignment - value: 'false' - - key: readability-function-size.NestingThreshold - value: '4294967295' - - key: modernize-use-override.AllowOverrideAndFinal - value: 'false' - - key: readability-function-size.ParameterThreshold - value: '4294967295' - - key: openmp-exception-escape.IgnoredExceptions - value: '' - - key: modernize-pass-by-value.ValuesOnly - value: 'false' - - key: modernize-loop-convert.IncludeStyle - value: llvm - - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons - value: '0' - - key: readability-identifier-naming.AggressiveDependentMemberLookup - value: 'false' - - key: readability-redundant-smartptr-get.IgnoreMacros - value: 'true' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-loop-convert.MakeReverseRangeHeader - value: '' - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-bool-literals.IgnoreMacros - value: 'true' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: modernize-avoid-bind.PermissiveParameterList - value: 'false' - - key: modernize-use-override.FinalSpelling - value: final - - key: performance-move-constructor-init.IncludeStyle - value: llvm - - key: modernize-loop-convert.UseCxx20ReverseRanges - value: 'true' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-using.IgnoreMacros - value: 'true' - - key: performance-type-promotion-in-math-fn.IncludeStyle - value: llvm - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-loop-convert.MakeReverseRangeFunction - value: '' - - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros - value: 'true' - - key: performance-no-automatic-move.AllowedTypes - value: '' - - key: performance-for-range-copy.WarnOnAllAutoCopies - value: 'false' - - key: readability-identifier-naming.IgnoreFailedSplit - value: 'false' - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: readability-qualified-auto.AddConstToQualified - value: 'true' - - key: readability-simplify-boolean-expr.ChainedConditionalReturn - value: 'false' - - key: readability-else-after-return.WarnOnConditionVariables - value: 'true' - - key: readability-uppercase-literal-suffix.IgnoreMacros - value: 'true' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-make-shared.IgnoreMacros - value: 'true' - - key: performance-unnecessary-copy-initialization.AllowedTypes - value: '' - - key: modernize-use-transparent-functors.SafeMode - value: 'false' - - key: modernize-make-shared.IgnoreDefaultInitialization - value: 'true' - - key: modernize-make-shared.IncludeStyle - value: llvm - - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - value: 'false' - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: readability-function-size.LineThreshold - value: '4294967295' - - key: performance-inefficient-vector-operation.EnableProto - value: 'false' - - key: modernize-use-override.IgnoreDestructors - value: 'false' - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: portability-simd-intrinsics.Suggest - value: 'false' - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: modernize-make-unique.IgnoreMacros - value: 'true' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: '' - - key: performance-for-range-copy.AllowedTypes - value: '' - - key: readability-redundant-string-init.StringNames - value: '::std::basic_string_view;::std::basic_string' - - key: modernize-make-unique.IgnoreDefaultInitialization - value: 'true' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: readability-magic-numbers.IgnoreBitFieldsWidths - value: 'true' - - key: modernize-make-unique.IncludeStyle - value: llvm - - key: readability-braces-around-statements.ShortStatementLines - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: readability-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: performance-inefficient-string-concatenation.StrictMode - value: 'false' - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: 'false' - - key: readability-redundant-declaration.IgnoreMacros - value: 'true' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: portability-restrict-system-includes.Includes - value: '*' - - key: readability-else-after-return.WarnOnUnfixable - value: 'true' - - key: modernize-use-emplace.IgnoreImplicitConstructors - value: 'false' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: '' - - key: modernize-use-equals-delete.IgnoreMacros - value: 'true' - - key: readability-magic-numbers.IgnoreAllFloatingPointValues - value: 'false' - - key: readability-uppercase-literal-suffix.NewSuffixes - value: '' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: performance-unnecessary-value-param.AllowedTypes - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: 'true' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: readability-function-cognitive-complexity.Threshold - value: '100' - - key: readability-function-cognitive-complexity.IgnoreMacros - value: 'true' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: performance-faster-string-find.StringLikeClasses - value: '::std::basic_string;::std::basic_string_view' - - key: readability-function-size.BranchThreshold - value: '4294967295' - - key: readability-implicit-bool-conversion.AllowIntegerConditions - value: 'false' - - key: readability-function-size.StatementThreshold - value: '800' - - key: modernize-use-default-member-init.IgnoreMacros - value: 'true' - - key: llvm-qualified-auto.AddConstToQualified - value: '0' - - key: readability-identifier-naming.IgnoreMainLikeFunctions - value: 'false' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: llvm-else-after-return.WarnOnConditionVariables - value: '0' - - key: modernize-raw-string-literal.DelimiterStem - value: lit - - key: modernize-use-equals-default.IgnoreMacros - value: 'true' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: 'false' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: performance-inefficient-vector-operation.VectorLikeClasses - value: '::std::vector' - - key: modernize-use-auto.RemoveStars - value: 'false' - - key: readability-magic-numbers.IgnorePowersOf2IntegerValues - value: 'true' - - key: portability-simd-intrinsics.Std - value: '' - - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors - value: 'false' - - key: performance-unnecessary-value-param.IncludeStyle - value: llvm - - key: modernize-replace-disallow-copy-and-assign-macro.MacroName - value: DISALLOW_COPY_AND_ASSIGN - - key: llvm-else-after-return.WarnOnUnfixable - value: '0' - - key: readability-simplify-subscript-expr.Types - value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array' -... -