diff options
| author | vitya-smirnov <[email protected]> | 2026-01-23 15:36:47 +0300 |
|---|---|---|
| committer | vitya-smirnov <[email protected]> | 2026-01-23 16:17:10 +0300 |
| commit | 5ec2ab12d84c8edd135d4a89d87e2fbd2b281f4e (patch) | |
| tree | 44cb327cb46af3c8b511fed6a8dd55f12bc04c0c | |
| parent | 457271e202ef3564c1b5f32f9092068635d17681 (diff) | |
YQL-20095: Enable google-explicit-constructor
commit_hash:4d77ad10fd4db303459ec4e45e139967c7fc8196
225 files changed, 557 insertions, 465 deletions
diff --git a/yql/essentials/.clang-tidy b/yql/essentials/.clang-tidy index f3f635f48c3..b7edf8d20ab 100644 --- a/yql/essentials/.clang-tidy +++ b/yql/essentials/.clang-tidy @@ -46,6 +46,7 @@ Checks: > bugprone-unused-return-value, bugprone-use-after-move, bugprone-virtual-near-miss, + google-explicit-constructor, modernize-use-override CheckOptions: - key: readability-identifier-naming.StructPrefix diff --git a/yql/essentials/ast/yql_constraint.h b/yql/essentials/ast/yql_constraint.h index c3688d1b9eb..56c7c109ede 100644 --- a/yql/essentials/ast/yql_constraint.h +++ b/yql/essentials/ast/yql_constraint.h @@ -491,7 +491,7 @@ class TEmptyConstraintNode final: public TConstraintNode { protected: friend struct TExprContext; - TEmptyConstraintNode(TExprContext& ctx); + explicit TEmptyConstraintNode(TExprContext& ctx); TEmptyConstraintNode(TExprContext& ctx, const NYT::TNode& serialized); TEmptyConstraintNode(TEmptyConstraintNode&& constr); diff --git a/yql/essentials/ast/yql_expr.cpp b/yql/essentials/ast/yql_expr.cpp index 4f67a62c444..58ca51363a4 100644 --- a/yql/essentials/ast/yql_expr.cpp +++ b/yql/essentials/ast/yql_expr.cpp @@ -140,7 +140,7 @@ struct TContext { TString File; ui16 SyntaxVersion = 0; - TContext(TExprContext& expr) + explicit TContext(TExprContext& expr) : Expr(expr) { } @@ -1712,7 +1712,7 @@ template <typename K, typename V> using TUnorderedMapIAllocator = std::unordered_map<K, V, std::hash<K>, std::equal_to<K>, TStdIAllocator<std::pair<const K, V>>>; struct TFrameContext { - TFrameContext(IAllocator* allocator) + explicit TFrameContext(IAllocator* allocator) : Nodes(std::less<size_t>(), allocator) , TopoSortedNodes(allocator) , Bindings(0, allocator) diff --git a/yql/essentials/ast/yql_expr.h b/yql/essentials/ast/yql_expr.h index be373d360dc..5e5b1c524d1 100644 --- a/yql/essentials/ast/yql_expr.h +++ b/yql/essentials/ast/yql_expr.h @@ -166,7 +166,7 @@ struct TDefaultTypeAnnotationVisitor: public TTypeAnnotationVisitor { class TErrorTypeVisitor: public TDefaultTypeAnnotationVisitor { public: - TErrorTypeVisitor(TExprContext& ctx); + explicit TErrorTypeVisitor(TExprContext& ctx); void Visit(const TErrorExprType& type) override; bool HasErrors() const; @@ -427,7 +427,7 @@ class TUnitExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Unit; - TUnitExprType(ui64 hash) + explicit TUnitExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeNonComputable | TypeNonPersistable, hash, 0) { @@ -447,7 +447,7 @@ class TUniversalExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Universal; - TUniversalExprType(ui64 hash) + explicit TUniversalExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeHasUniversal, hash, 0) { } @@ -466,7 +466,7 @@ class TUniversalStructExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::UniversalStruct; - TUniversalStructExprType(ui64 hash) + explicit TUniversalStructExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeHasUniversal, hash, 0) { } @@ -1087,7 +1087,7 @@ class TWorldExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::World; - TWorldExprType(ui64 hash) + explicit TWorldExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeNonComposable | TypeNonComputable | TypeNonPersistable | TypeNonInspectable, hash, 0) { @@ -1244,7 +1244,7 @@ class TVoidExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Void; - TVoidExprType(ui64 hash) + explicit TVoidExprType(ui64 hash) : TTypeAnnotationNode(KindValue, 0, hash, 0) { } @@ -1263,7 +1263,7 @@ class TNullExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Null; - TNullExprType(ui64 hash) + explicit TNullExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeHasNull, hash, 0) { } @@ -1412,7 +1412,7 @@ class TGenericExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Generic; - TGenericExprType(ui64 hash) + explicit TGenericExprType(ui64 hash) : TTypeAnnotationNode(KindValue, TypeNonComputable, hash, 0) { } @@ -1523,7 +1523,7 @@ class TEmptyListExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::EmptyList; - TEmptyListExprType(ui64 hash) + explicit TEmptyListExprType(ui64 hash) : TTypeAnnotationNode(KindValue, 0, hash, 0) { } @@ -1542,7 +1542,7 @@ class TEmptyDictExprType: public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::EmptyDict; - TEmptyDictExprType(ui64 hash) + explicit TEmptyDictExprType(ui64 hash) : TTypeAnnotationNode(KindValue, 0, hash, 0) { } @@ -2835,7 +2835,7 @@ using TSingletonTypeCache = std::tuple< class TExprCycleDetector { public: - TExprCycleDetector(ui64 maxQueueSize); + explicit TExprCycleDetector(ui64 maxQueueSize); void Reset(); void AddNode(const TExprNode& node); @@ -2851,7 +2851,7 @@ struct TExprContext: private TNonCopyable { TFreezeGuard(const TFreezeGuard&) = delete; TFreezeGuard& operator=(const TFreezeGuard&) = delete; - TFreezeGuard(TExprContext& ctx) + explicit TFreezeGuard(TExprContext& ctx) : Ctx_(ctx) { Ctx_.Freeze(); diff --git a/yql/essentials/ast/yql_expr_builder.h b/yql/essentials/ast/yql_expr_builder.h index bfd5ec22a4b..c70ba788d55 100644 --- a/yql/essentials/ast/yql_expr_builder.h +++ b/yql/essentials/ast/yql_expr_builder.h @@ -120,7 +120,7 @@ private: struct TBuildAdapter { typedef TExprNodeReplaceBuilder& ResultType; - TBuildAdapter(TExprNodeReplaceBuilder& builder) + explicit TBuildAdapter(TExprNodeReplaceBuilder& builder) : Builder(builder) { } diff --git a/yql/essentials/ast/yql_type_string.cpp b/yql/essentials/ast/yql_type_string.cpp index 3370a8047e1..861033a31b4 100644 --- a/yql/essentials/ast/yql_type_string.cpp +++ b/yql/essentials/ast/yql_type_string.cpp @@ -1347,7 +1347,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TTypePrinter: public TTypeAnnotationVisitor { public: - TTypePrinter(IOutputStream& out) + explicit TTypePrinter(IOutputStream& out) : Out_(out) { } diff --git a/yql/essentials/core/arrow_kernels/request/request.h b/yql/essentials/core/arrow_kernels/request/request.h index 8109ef171b1..6ffcdf08a9d 100644 --- a/yql/essentials/core/arrow_kernels/request/request.h +++ b/yql/essentials/core/arrow_kernels/request/request.h @@ -43,7 +43,7 @@ public: Coalesce }; - TKernelRequestBuilder(const NKikimr::NMiniKQL::IFunctionRegistry& functionRegistry, TLangVersion langver = MinLangVersion); + explicit TKernelRequestBuilder(const NKikimr::NMiniKQL::IFunctionRegistry& functionRegistry, TLangVersion langver = MinLangVersion); ~TKernelRequestBuilder(); ui32 AddUnaryOp(EUnaryOp op, const TTypeAnnotationNode* arg1Type, const TTypeAnnotationNode* retType); diff --git a/yql/essentials/core/cbo/cbo_hints.cpp b/yql/essentials/core/cbo/cbo_hints.cpp index 0c603f4d49d..11027a38c32 100644 --- a/yql/essentials/core/cbo/cbo_hints.cpp +++ b/yql/essentials/core/cbo/cbo_hints.cpp @@ -15,7 +15,7 @@ TString ToLower(TString s) { class TOptimizerHintsParser { public: - TOptimizerHintsParser(const TString& text) + explicit TOptimizerHintsParser(const TString& text) : Pos_(-1) , Size_(static_cast<i32>(text.size()) - 1) , Text_(text) diff --git a/yql/essentials/core/cbo/cbo_interesting_orderings.h b/yql/essentials/core/cbo/cbo_interesting_orderings.h index 03200ad82e2..281f358fb22 100644 --- a/yql/essentials/core/cbo/cbo_interesting_orderings.h +++ b/yql/essentials/core/cbo/cbo_interesting_orderings.h @@ -135,7 +135,7 @@ public: TBaseColumn& operator=(const TBaseColumn& other); NDq::TJoinColumn ToJoinColumn(); - operator bool(); + explicit operator bool(); TString Relation; TString Column; @@ -348,7 +348,7 @@ public: TLogicalOrderings(const TLogicalOrderings&) = default; TLogicalOrderings& operator=(const TLogicalOrderings&) = default; - TLogicalOrderings(TDFSM* dfsm) + explicit TLogicalOrderings(TDFSM* dfsm) : Dfsm_(dfsm) { } @@ -393,7 +393,7 @@ public: public: TOrderingsStateMachine() = default; - TOrderingsStateMachine( + explicit TOrderingsStateMachine( TFDStorage fdStorage, TOrdering::EType machineType = TOrdering::EShuffle) : FDStorage(std::move(fdStorage)) diff --git a/yql/essentials/core/cbo/cbo_optimizer_new.h b/yql/essentials/core/cbo/cbo_optimizer_new.h index 9a7cea307be..a1fff85be69 100644 --- a/yql/essentials/core/cbo/cbo_optimizer_new.h +++ b/yql/essentials/core/cbo/cbo_optimizer_new.h @@ -35,7 +35,7 @@ public: EOptimizerNodeKind Kind; TOptimizerStatistics Stats; - IBaseOptimizerNode(EOptimizerNodeKind k) + explicit IBaseOptimizerNode(EOptimizerNodeKind k) : Kind(k) { } @@ -164,7 +164,7 @@ struct TJoinOrderHints { }; struct TRelationNode: public ITreeNode { - TRelationNode(TString label) + explicit TRelationNode(TString label) : Label(std::move(label)) { this->Type = ITreeNode::Relation; @@ -380,7 +380,7 @@ public: using TPtr = std::shared_ptr<IOptimizerNew>; IProviderContext& Pctx; - IOptimizerNew(IProviderContext& ctx) + explicit IOptimizerNew(IProviderContext& ctx) : Pctx(ctx) { } diff --git a/yql/essentials/core/dq_integration/yql_dq_integration.h b/yql/essentials/core/dq_integration/yql_dq_integration.h index 119b9dcadbd..2e650511aae 100644 --- a/yql/essentials/core/dq_integration/yql_dq_integration.h +++ b/yql/essentials/core/dq_integration/yql_dq_integration.h @@ -30,7 +30,7 @@ class TMkqlCallableCompilerBase; class TFallbackError: public yexception { public: - TFallbackError(TIssuePtr issue = {}) + explicit TFallbackError(TIssuePtr issue = {}) : Issue_(std::move(issue)) { } diff --git a/yql/essentials/core/expr_nodes/yql_expr_nodes.h b/yql/essentials/core/expr_nodes/yql_expr_nodes.h index c9ab88ff99f..021818cd9f3 100644 --- a/yql/essentials/core/expr_nodes/yql_expr_nodes.h +++ b/yql/essentials/core/expr_nodes/yql_expr_nodes.h @@ -23,6 +23,8 @@ public: { } + // TODO(YQL-20095): there are YDB usages + // NOLINTNEXTLINE(google-explicit-constructor) operator TStringBuf() const { return Value(); } @@ -238,12 +240,12 @@ class TExprApplier: public TExprBase { template <typename TParent, typename TNode> friend class TNodeBuilder; - TExprApplier(const TExprNode::TPtr& node) + explicit TExprApplier(const TExprNode::TPtr& node) : TExprBase(node) { } - TExprApplier(const TExprBase node) + explicit TExprApplier(const TExprBase node) : TExprBase(node) { } @@ -256,10 +258,14 @@ public: : TMaybeNode<TExprBase>() { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node) : TMaybeNode<TExprBase>(node) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : TMaybeNode<TExprBase>(node) { } diff --git a/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h b/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h index d05ffa9e5a7..92705c0dd31 100644 --- a/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h +++ b/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h @@ -89,17 +89,23 @@ private: template <> class TMaybeNode<TExprBase> { public: + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node = nullptr) : Raw_(node) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : Raw_(node.Get()) , Node_(node) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprBase& node) : Raw_(node.Raw()) , Node_(node.Ptr()) @@ -164,7 +170,7 @@ public: CurIt_ = EndIt_ = {}; } - TChildIterator(const TExprBase& node, size_t startIndex = 0) + explicit TChildIterator(const TExprBase& node, size_t startIndex = 0) : CurIt_(node.Ref().Children().begin() + startIndex) , EndIt_(node.Ref().Children().end()) { @@ -215,13 +221,13 @@ private: template <typename TItem> class TListBase: public TExprBase { public: - TListBase(const TExprNode* node) + explicit TListBase(const TExprNode* node) : TExprBase(node) { YQL_ENSURE(Match(node)); } - TListBase(const TExprNode::TPtr& node) + explicit TListBase(const TExprNode::TPtr& node) : TExprBase(node) { YQL_ENSURE(Match(node.Get())); @@ -253,10 +259,14 @@ public: template <typename TItem> class TMaybeNode<TListBase<TItem>>: public TMaybeNode<TExprBase> { public: + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node) : TMaybeNode<TExprBase>(node && TListBase<TItem>::Match(node) ? node : nullptr) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : TMaybeNode<TExprBase>(node && TListBase<TItem>::Match(node.Get()) ? node : TExprNode::TPtr()) { } @@ -307,14 +317,20 @@ public: template <> class TMaybeNode<TCallable>: public TMaybeNode<TExprBase> { public: + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node = nullptr) : TMaybeNode<TExprBase>(node && TCallable::Match(node) ? node : nullptr) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : TMaybeNode<TExprBase>(node && TCallable::Match(node.Get()) ? node : TExprNode::TPtr()) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TCallable& node) : TMaybeNode(node.Ptr()) { @@ -360,10 +376,14 @@ public: template <typename TItem> class TMaybeNode<TVarArgCallable<TItem>>: public TMaybeNode<TExprBase> { public: + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node) : TMaybeNode<TExprBase>(node && TVarArgCallable<TItem>::Match(node) ? node : nullptr) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : TMaybeNode<TExprBase>(node && TVarArgCallable<TItem>::Match(node.Get()) ? node : TExprNode::TPtr()) { } @@ -447,14 +467,20 @@ public: template <const size_t FixedArgsCount> class TMaybeNode<TFreeArgCallable<FixedArgsCount>>: public TMaybeNode<TExprBase> { public: + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode* node) : TMaybeNode<TExprBase>(node && TFreeArgCallable<FixedArgsCount>::Match(node) ? node : nullptr) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprNode::TPtr& node) : TMaybeNode<TExprBase>(node && TFreeArgCallable<FixedArgsCount>::Match(node.Get()) ? node : TExprNode::TPtr()) { } + // Implicit item to Maybe lifting is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) TMaybeNode(const TExprBase& node) : TMaybeNode(node) { diff --git a/yql/essentials/core/facade/yql_facade.cpp b/yql/essentials/core/facade/yql_facade.cpp index 00520cec53c..5d2adebc3d4 100644 --- a/yql/essentials/core/facade/yql_facade.cpp +++ b/yql/essentials/core/facade/yql_facade.cpp @@ -75,7 +75,7 @@ const TString StartTimeLabel = "StartTime"; class TUrlLoader: public IUrlLoader { public: - TUrlLoader(TFileStoragePtr storage) + explicit TUrlLoader(TFileStoragePtr storage) : Storage_(storage) { } diff --git a/yql/essentials/core/file_storage/file_storage.cpp b/yql/essentials/core/file_storage/file_storage.cpp index f45f08125a1..abc3fd12571 100644 --- a/yql/essentials/core/file_storage/file_storage.cpp +++ b/yql/essentials/core/file_storage/file_storage.cpp @@ -302,7 +302,7 @@ private: class TFileStorageWithAsync: public TFileStorageDecorator { public: - TFileStorageWithAsync(TFileStoragePtr fs) + explicit TFileStorageWithAsync(TFileStoragePtr fs) : TFileStorageDecorator(std::move(fs)) , QueueStarted_(0) { diff --git a/yql/essentials/core/file_storage/file_storage_decorator.h b/yql/essentials/core/file_storage/file_storage_decorator.h index 721c6610622..120526dcb05 100644 --- a/yql/essentials/core/file_storage/file_storage_decorator.h +++ b/yql/essentials/core/file_storage/file_storage_decorator.h @@ -6,7 +6,7 @@ namespace NYql { class TFileStorageDecorator: public IFileStorage { public: - TFileStorageDecorator(TFileStoragePtr fs); + explicit TFileStorageDecorator(TFileStoragePtr fs); ~TFileStorageDecorator() override = default; TFileLinkPtr PutFile(const TString& file, const TString& outFileName) override; diff --git a/yql/essentials/core/file_storage/storage_ut.cpp b/yql/essentials/core/file_storage/storage_ut.cpp index 2f0ed68db95..d86853ad125 100644 --- a/yql/essentials/core/file_storage/storage_ut.cpp +++ b/yql/essentials/core/file_storage/storage_ut.cpp @@ -24,7 +24,7 @@ private: TFsPath Path_; public: - TTestDir(const TString& name) { + explicit TTestDir(const TString& name) { Y_ENSURE(name.length() > 0, "have to specify name"); Y_ENSURE(name.find('.') == TString::npos, "must be simple name"); Y_ENSURE(name.find('/') == TString::npos, "must be simple name"); diff --git a/yql/essentials/core/histogram/eq_width_histogram.h b/yql/essentials/core/histogram/eq_width_histogram.h index 9f0d73e12c0..cff5c29a0a2 100644 --- a/yql/essentials/core/histogram/eq_width_histogram.h +++ b/yql/essentials/core/histogram/eq_width_histogram.h @@ -157,7 +157,7 @@ public: #pragma pack(pop) // Have to specify the number of buckets and type of the values. - TEqWidthHistogram(ui32 numBuckets = 1, EHistogramValueType type = EHistogramValueType::Int32); + explicit TEqWidthHistogram(ui32 numBuckets = 1, EHistogramValueType type = EHistogramValueType::Int32); // From serialized data. TEqWidthHistogram(const char* str, size_t size); @@ -287,7 +287,7 @@ private: // This class represents a machinery to estimate a value in a histogram. class TEqWidthHistogramEstimator { public: - TEqWidthHistogramEstimator(std::shared_ptr<TEqWidthHistogram> histogram); + explicit TEqWidthHistogramEstimator(std::shared_ptr<TEqWidthHistogram> histogram); // Methods to estimate values. template <typename T> diff --git a/yql/essentials/core/layers/layers.cpp b/yql/essentials/core/layers/layers.cpp index 9481f8a9577..677a14c71c6 100644 --- a/yql/essentials/core/layers/layers.cpp +++ b/yql/essentials/core/layers/layers.cpp @@ -267,7 +267,7 @@ private: class TDummyRemoteLayerProvider: public IRemoteLayerProvider { public: - TDummyRemoteLayerProvider(TString errorMessage) + explicit TDummyRemoteLayerProvider(TString errorMessage) : ErrorMessage_(std::move(errorMessage)) { } diff --git a/yql/essentials/core/layers/layers_fwd.h b/yql/essentials/core/layers/layers_fwd.h index fbef115ca06..1860d69ef5b 100644 --- a/yql/essentials/core/layers/layers_fwd.h +++ b/yql/essentials/core/layers/layers_fwd.h @@ -19,7 +19,7 @@ using TLocations = TVector<TLocation>; class TKey { public: - TKey(TMaybe<TString>&& name, TMaybe<TString>&& url = {}) + explicit TKey(TMaybe<TString>&& name, TMaybe<TString>&& url = {}) : Name(name) , Url(url) { diff --git a/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp b/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp index 6b9c9acb53d..20642f5e30b 100644 --- a/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp +++ b/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp @@ -2423,7 +2423,7 @@ IGraphTransformer::TStatus PeepHoleBlockStage(const TExprNode::TPtr& input, TExp class TStrongTypeErrorProxy : public IGraphTransformer { public: - TStrongTypeErrorProxy(IGraphTransformer& inner) + explicit TStrongTypeErrorProxy(IGraphTransformer& inner) : Inner_(inner) {} diff --git a/yql/essentials/core/pg_settings/guc_settings.h b/yql/essentials/core/pg_settings/guc_settings.h index 60796982add..dba3b5ac16e 100644 --- a/yql/essentials/core/pg_settings/guc_settings.h +++ b/yql/essentials/core/pg_settings/guc_settings.h @@ -12,7 +12,7 @@ class TGUCSettings { public: TGUCSettings() = default; - TGUCSettings(const TString& serialized); + explicit TGUCSettings(const TString& serialized); using TPtr = std::shared_ptr<TGUCSettings>; void Setup(const std::unordered_map<std::string, std::string>& runtimeSettings); diff --git a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.cpp b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.cpp index 429b5be0e40..bc833fa2396 100644 --- a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.cpp +++ b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.cpp @@ -5,7 +5,7 @@ namespace NYql { class TQWriterDecorator: public IQWriter { public: - TQWriterDecorator(IQWriterPtr&& underlying) + explicit TQWriterDecorator(IQWriterPtr&& underlying) : Underlying_(std::move(underlying)) { } diff --git a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h index dbcafc86bae..72f2f5869f2 100644 --- a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h +++ b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h @@ -104,13 +104,13 @@ public: { } - TQContext(IQReaderPtr reader, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) + explicit TQContext(IQReaderPtr reader, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) : CaptureMode_(captureMode) , Reader_(reader) { } - TQContext(IQWriterPtr writer, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) + explicit TQContext(IQWriterPtr writer, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) : CaptureMode_(captureMode) , Writer_(writer) { @@ -119,7 +119,7 @@ public: TQContext(const TQContext&) = default; TQContext& operator=(const TQContext&) = default; - operator bool() const { + explicit operator bool() const { return CanRead() || CanWrite(); } diff --git a/yql/essentials/core/qplayer/storage/memory/yql_qstorage_memory.cpp b/yql/essentials/core/qplayer/storage/memory/yql_qstorage_memory.cpp index f0782f70252..791a8ded999 100644 --- a/yql/essentials/core/qplayer/storage/memory/yql_qstorage_memory.cpp +++ b/yql/essentials/core/qplayer/storage/memory/yql_qstorage_memory.cpp @@ -29,7 +29,7 @@ using TStatePtr = std::shared_ptr<TState>; class TReader: public IQReader { public: - TReader(const TOperationMap::TMapPtr& map) + explicit TReader(const TOperationMap::TMapPtr& map) : Map_(map) { } diff --git a/yql/essentials/core/qplayer/storage/ydb/yql_qstorage_ydb.cpp b/yql/essentials/core/qplayer/storage/ydb/yql_qstorage_ydb.cpp index 85c85c3d071..f29298f2936 100644 --- a/yql/essentials/core/qplayer/storage/ydb/yql_qstorage_ydb.cpp +++ b/yql/essentials/core/qplayer/storage/ydb/yql_qstorage_ydb.cpp @@ -223,7 +223,7 @@ private: class TStorage: public IQStorage { public: - TStorage(const TYdbQStorageSettings& settings) + explicit TStorage(const TYdbQStorageSettings& settings) : Settings_(settings) { } diff --git a/yql/essentials/core/services/yql_plan.cpp b/yql/essentials/core/services/yql_plan.cpp index 50bbe9966c6..2c20d325530 100644 --- a/yql/essentials/core/services/yql_plan.cpp +++ b/yql/essentials/core/services/yql_plan.cpp @@ -12,7 +12,7 @@ struct TPinAttrs { ui32 ProviderId = 0; ui32 PinId = 0; - TPinAttrs(const TPinInfo& info) + explicit TPinAttrs(const TPinInfo& info) : Info(info) { } @@ -93,7 +93,7 @@ struct TLevelContext { { } - TLevelContext(TBasicNode* node) + explicit TLevelContext(TBasicNode* node) : Node(node) { } @@ -186,7 +186,7 @@ ui32 FillLevels(THashMap<ui32, TLevelContext>& basicNodesMap, ui32 current, THas class TPlanBuilder: public IPlanBuilder { public: - TPlanBuilder(TTypeAnnotationContext& types) + explicit TPlanBuilder(TTypeAnnotationContext& types) : Types_(types) { } diff --git a/yql/essentials/core/services/yql_transform_pipeline.h b/yql/essentials/core/services/yql_transform_pipeline.h index ca1dbfae83d..bff3a12e667 100644 --- a/yql/essentials/core/services/yql_transform_pipeline.h +++ b/yql/essentials/core/services/yql_transform_pipeline.h @@ -20,8 +20,8 @@ namespace NYql { class TTransformationPipeline { public: - TTransformationPipeline(TIntrusivePtr<TTypeAnnotationContext> ctx, - TTypeAnnCallableFactory typeAnnCallableFactory = {}); + explicit TTransformationPipeline(TIntrusivePtr<TTypeAnnotationContext> ctx, + TTypeAnnCallableFactory typeAnnCallableFactory = {}); TTransformationPipeline& AddServiceTransformers(EYqlIssueCode issueCode = TIssuesIds::CORE_GC); TTransformationPipeline& AddParametersEvaluation(const NKikimr::NMiniKQL::IFunctionRegistry& functionRegistry, EYqlIssueCode issueCode = TIssuesIds::CORE_PARAM_EVALUATION); diff --git a/yql/essentials/core/sql_types/window_frame_bounds.h b/yql/essentials/core/sql_types/window_frame_bounds.h index c86aa52a6e1..bf0966d8a28 100644 --- a/yql/essentials/core/sql_types/window_frame_bounds.h +++ b/yql/essentials/core/sql_types/window_frame_bounds.h @@ -144,7 +144,7 @@ public: const bool IsIncremental_; }; - TCoreWinFrameCollectorBounds(bool dedup) + explicit TCoreWinFrameCollectorBounds(bool dedup) : Dedup_(dedup) { } diff --git a/yql/essentials/core/type_ann/type_ann_core.cpp b/yql/essentials/core/type_ann/type_ann_core.cpp index 5483023efe8..c3f25a07294 100644 --- a/yql/essentials/core/type_ann/type_ann_core.cpp +++ b/yql/essentials/core/type_ann/type_ann_core.cpp @@ -15169,7 +15169,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> class TIntentDeterminationTransformer : public TSyncTransformerBase { public: - TIntentDeterminationTransformer(const TTypeAnnotationContext& types) + explicit TIntentDeterminationTransformer(const TTypeAnnotationContext& types) : Types_(types) {} diff --git a/yql/essentials/core/type_ann/type_ann_impl.h b/yql/essentials/core/type_ann/type_ann_impl.h index 32d275e71bc..988eba2eb94 100644 --- a/yql/essentials/core/type_ann/type_ann_impl.h +++ b/yql/essentials/core/type_ann/type_ann_impl.h @@ -13,7 +13,7 @@ namespace NTypeAnnImpl { struct TContext { TExprContext& Expr; - TContext(TExprContext& expr); + explicit TContext(TExprContext& expr); }; struct TExtContext : public TContext { diff --git a/yql/essentials/core/url_lister/url_lister_manager.cpp b/yql/essentials/core/url_lister/url_lister_manager.cpp index d16a4592e81..f462f8187f5 100644 --- a/yql/essentials/core/url_lister/url_lister_manager.cpp +++ b/yql/essentials/core/url_lister/url_lister_manager.cpp @@ -13,7 +13,7 @@ namespace NYql::NPrivate { class TUrlListerManager: public IUrlListerManager { public: - TUrlListerManager( + explicit TUrlListerManager( TVector<IUrlListerPtr> urlListers) : UrlListers_(std::move(urlListers)) { diff --git a/yql/essentials/core/url_preprocessing/url_preprocessing.h b/yql/essentials/core/url_preprocessing/url_preprocessing.h index deb21c71649..d972de3fcd2 100644 --- a/yql/essentials/core/url_preprocessing/url_preprocessing.h +++ b/yql/essentials/core/url_preprocessing/url_preprocessing.h @@ -20,7 +20,7 @@ class TUrlPreprocessing: public IUrlPreprocessing { public: using TPtr = TIntrusivePtr<TUrlPreprocessing>; - TUrlPreprocessing(const TGatewaysConfig& cfg) { + explicit TUrlPreprocessing(const TGatewaysConfig& cfg) { Configure(false, cfg); } TUrlPreprocessing() = default; diff --git a/yql/essentials/core/yql_default_valid_value.cpp b/yql/essentials/core/yql_default_valid_value.cpp index d22906c5d3d..de3e3270cb4 100644 --- a/yql/essentials/core/yql_default_valid_value.cpp +++ b/yql/essentials/core/yql_default_valid_value.cpp @@ -8,7 +8,7 @@ namespace { class TIsValidValueSupportedVisitor: public TTypeAnnotationVisitor { public: - TIsValidValueSupportedVisitor(const TTypeAnnotationNode* type) + explicit TIsValidValueSupportedVisitor(const TTypeAnnotationNode* type) : Type_(type) { } diff --git a/yql/essentials/core/yql_graph_transformer.cpp b/yql/essentials/core/yql_graph_transformer.cpp index 92c00c9e020..24b7af676cc 100644 --- a/yql/essentials/core/yql_graph_transformer.cpp +++ b/yql/essentials/core/yql_graph_transformer.cpp @@ -10,7 +10,7 @@ namespace { class TSharedTransformerProxy : public IGraphTransformer { public: - TSharedTransformerProxy(const std::shared_ptr<IGraphTransformer>& inner) + explicit TSharedTransformerProxy(const std::shared_ptr<IGraphTransformer>& inner) : Inner_(inner) {} diff --git a/yql/essentials/core/yql_graph_transformer.h b/yql/essentials/core/yql_graph_transformer.h index 0ed3559c812..408837e2036 100644 --- a/yql/essentials/core/yql_graph_transformer.h +++ b/yql/essentials/core/yql_graph_transformer.h @@ -50,6 +50,8 @@ public: return Level != other; } + // Using ELevel as TStatus is a common pattern + // NOLINTNEXTLINE(google-explicit-constructor) TStatus(ELevel level, bool hasRestart = false) : Level(level) , HasRestart(hasRestart) @@ -279,7 +281,7 @@ public: template <typename TFunctor> class TFunctorTransformer: public TSyncTransformerBase { public: - TFunctorTransformer(TFunctor functor) + explicit TFunctorTransformer(TFunctor functor) : Functor_(std::move(functor)) {} TStatus DoTransform(TExprNode::TPtr input, TExprNode::TPtr& output, TExprContext& ctx) override { @@ -300,7 +302,7 @@ template <typename TFunctor> class TSinglePassFunctorTransformer final: public TFunctorTransformer<TFunctor> { using TBase = TFunctorTransformer<TFunctor>; public: - TSinglePassFunctorTransformer(TFunctor functor) + explicit TSinglePassFunctorTransformer(TFunctor functor) : TFunctorTransformer<TFunctor>(std::move(functor)) {} diff --git a/yql/essentials/core/yql_linear_checker.cpp b/yql/essentials/core/yql_linear_checker.cpp index 175495d0e93..fef6101ecd1 100644 --- a/yql/essentials/core/yql_linear_checker.cpp +++ b/yql/essentials/core/yql_linear_checker.cpp @@ -56,7 +56,7 @@ public: // length = 1 for Linear, N for Struct/Tuple using TUsage = TStackVec<TMaybe<TPositionHandle>, 1>; - TUsageVisitor(TExprContext& ctx) + explicit TUsageVisitor(TExprContext& ctx) : Ctx_(ctx) {} diff --git a/yql/essentials/core/yql_opt_normalize_depends_on.cpp b/yql/essentials/core/yql_opt_normalize_depends_on.cpp index 7db01cb0d57..ccba406c90f 100644 --- a/yql/essentials/core/yql_opt_normalize_depends_on.cpp +++ b/yql/essentials/core/yql_opt_normalize_depends_on.cpp @@ -12,7 +12,7 @@ namespace { class TNormalizeDependsOnTransformer : public TSyncTransformerBase { public: - TNormalizeDependsOnTransformer(const TTypeAnnotationContext& types) + explicit TNormalizeDependsOnTransformer(const TTypeAnnotationContext& types) : Types_(types) {} diff --git a/yql/essentials/core/yql_opt_window.cpp b/yql/essentials/core/yql_opt_window.cpp index d2a5c2a6296..8b301a0e497 100644 --- a/yql/essentials/core/yql_opt_window.cpp +++ b/yql/essentials/core/yql_opt_window.cpp @@ -134,7 +134,7 @@ public: } private: - TNumberAndDirectionWithSerialized(EDirection direction) + explicit TNumberAndDirectionWithSerialized(EDirection direction) : Value_(TNumberAndDirection<T>::Inf(direction)) , String_(TNumberAndDirection<TString>::Inf(direction)) { @@ -161,7 +161,7 @@ public: } private: - TNumberAndDirectionWithSerialized(EDirection direction) + explicit TNumberAndDirectionWithSerialized(EDirection direction) : String_(TNumberAndDirection<TString>::Inf(direction)) { } diff --git a/yql/essentials/core/yql_statistics.h b/yql/essentials/core/yql_statistics.h index a2725639ab9..09104d28872 100644 --- a/yql/essentials/core/yql_statistics.h +++ b/yql/essentials/core/yql_statistics.h @@ -84,7 +84,7 @@ struct TColumnStatistics { struct TOptimizerStatistics { struct TKeyColumns : public TSimpleRefCount<TKeyColumns> { TVector<TString> Data; - TKeyColumns(TVector<TString> data) : Data(std::move(data)) {} + explicit TKeyColumns(TVector<TString> data) : Data(std::move(data)) {} TVector<NDq::TJoinColumn> ToJoinColumns(const TString& alias) { TVector<NDq::TJoinColumn> columns; @@ -110,12 +110,12 @@ struct TOptimizerStatistics { struct TColumnStatMap : public TSimpleRefCount<TColumnStatMap> { THashMap<TString,TColumnStatistics> Data; TColumnStatMap() {} - TColumnStatMap(THashMap<TString,TColumnStatistics> data) : Data(std::move(data)) {} + explicit TColumnStatMap(THashMap<TString,TColumnStatistics> data) : Data(std::move(data)) {} }; struct TShuffledByColumns : public TSimpleRefCount<TShuffledByColumns> { TVector<NDq::TJoinColumn> Data; - TShuffledByColumns(TVector<NDq::TJoinColumn> data) : Data(std::move(data)) {} + explicit TShuffledByColumns(TVector<NDq::TJoinColumn> data) : Data(std::move(data)) {} TString ToString() { TString result; @@ -169,7 +169,7 @@ struct TOptimizerStatistics { TOptimizerStatistics& operator=(const TOptimizerStatistics&) = default; TOptimizerStatistics() = default; - TOptimizerStatistics( + explicit TOptimizerStatistics( EStatisticsType type, double nrows = 0.0, int ncols = 0, diff --git a/yql/essentials/minikql/aligned_page_pool.cpp b/yql/essentials/minikql/aligned_page_pool.cpp index 4bff633ed17..7eee64dc954 100644 --- a/yql/essentials/minikql/aligned_page_pool.cpp +++ b/yql/essentials/minikql/aligned_page_pool.cpp @@ -68,7 +68,7 @@ class TGlobalPagePool { friend class TGlobalPools<T, SysAlign>; public: - TGlobalPagePool(size_t pageSize) + explicit TGlobalPagePool(size_t pageSize) : PageSize_(pageSize) { } diff --git a/yql/essentials/minikql/aligned_page_pool_ut.cpp b/yql/essentials/minikql/aligned_page_pool_ut.cpp index d586d002e9e..a7920a3a01f 100644 --- a/yql/essentials/minikql/aligned_page_pool_ut.cpp +++ b/yql/essentials/minikql/aligned_page_pool_ut.cpp @@ -21,7 +21,7 @@ public: } }; - TScopedMemoryMapper(bool aligned) { + explicit TScopedMemoryMapper(bool aligned) { Aligned_ = aligned; TFakeMmap::OnMunmap = [this](void* addr, size_t s) { Munmaps_.push_back({addr, s}); diff --git a/yql/essentials/minikql/arrow/arrow_util.h b/yql/essentials/minikql/arrow/arrow_util.h index 5500e4f7d14..0c24a2ff307 100644 --- a/yql/essentials/minikql/arrow/arrow_util.h +++ b/yql/essentials/minikql/arrow/arrow_util.h @@ -190,7 +190,7 @@ struct TPrimitiveDataType<NYql::NDecimal::TInt128> { class TScalarResult: public arrow::FixedSizeBinaryScalar { public: - TScalarResult(std::shared_ptr<arrow::Buffer> value) + explicit TScalarResult(std::shared_ptr<arrow::Buffer> value) : arrow::FixedSizeBinaryScalar(std::move(value), arrow::fixed_size_binary(16)) { } diff --git a/yql/essentials/minikql/arrow/mkql_functions.cpp b/yql/essentials/minikql/arrow/mkql_functions.cpp index 4268cd69c3b..48ffae550dc 100644 --- a/yql/essentials/minikql/arrow/mkql_functions.cpp +++ b/yql/essentials/minikql/arrow/mkql_functions.cpp @@ -20,7 +20,7 @@ bool ConvertInputArrowType(TType* blockType, arrow::ValueDescr& descr) { class TOutputTypeVisitor: public arrow::TypeVisitor { public: - TOutputTypeVisitor(TTypeEnvironment& env) + explicit TOutputTypeVisitor(TTypeEnvironment& env) : Env_(env) { } diff --git a/yql/essentials/minikql/comp_nodes/mkql_block_coalesce_blending_helper.h b/yql/essentials/minikql/comp_nodes/mkql_block_coalesce_blending_helper.h index 97799320046..f699d4b97c3 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_block_coalesce_blending_helper.h +++ b/yql/essentials/minikql/comp_nodes/mkql_block_coalesce_blending_helper.h @@ -43,7 +43,7 @@ TType* GetScalar(const arrow::Datum& datum) { template <typename TType> class TDatumStorageView { public: - TDatumStorageView(const arrow::Datum& datum) + explicit TDatumStorageView(const arrow::Datum& datum) : Datum_(datum) { } diff --git a/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h b/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h index da1d3972cb6..d0162ee3892 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h +++ b/yql/essentials/minikql/comp_nodes/mkql_rh_hash.h @@ -70,7 +70,7 @@ protected: , Hash(0) { } - TPSLStorageImpl(const ui64 hash) + explicit TPSLStorageImpl(const ui64 hash) : Distance(0) , Hash(hash) { @@ -85,7 +85,7 @@ public: : Distance(-1) { } - TPSLStorageImpl(const ui64 /*hash*/) + explicit TPSLStorageImpl(const ui64 /*hash*/) : Distance(0) { } diff --git a/yql/essentials/minikql/comp_nodes/mkql_wide_top_sort.cpp b/yql/essentials/minikql/comp_nodes/mkql_wide_top_sort.cpp index 044e9939218..ad00ad6f2ff 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_wide_top_sort.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_wide_top_sort.cpp @@ -25,14 +25,14 @@ struct TKeyInfo { }; struct TRuntimeKeyInfo { - TRuntimeKeyInfo(const TKeyInfo& keyInfo) + explicit TRuntimeKeyInfo(const TKeyInfo& keyInfo) : Slot(keyInfo.Slot) , IsOptional(keyInfo.IsOptional) , Compare(keyInfo.Compare.Get()) { if (keyInfo.PresortType) { - LeftPacker = keyInfo.PresortType; - RightPacker = keyInfo.PresortType; + LeftPacker = TGenericPresortEncoder(keyInfo.PresortType); + RightPacker = TGenericPresortEncoder(keyInfo.PresortType); } } @@ -44,7 +44,7 @@ struct TRuntimeKeyInfo { }; struct TMyValueCompare { - TMyValueCompare(const std::vector<TKeyInfo>& keys) + explicit TMyValueCompare(const std::vector<TKeyInfo>& keys) : Keys(keys.cbegin(), keys.cend()) { } diff --git a/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp b/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp index 64ff5109e6b..255e8cbc997 100644 --- a/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp +++ b/yql/essentials/minikql/comp_nodes/ut/mkql_test_factory.cpp @@ -101,7 +101,7 @@ public: ui64 Index_ = 0; }; - TTestYieldStreamWrapper(TComputationMutables& mutables) + explicit TTestYieldStreamWrapper(TComputationMutables& mutables) : TBaseComputation(mutables) { } diff --git a/yql/essentials/minikql/comp_nodes/ut/mkql_udf_ut.cpp b/yql/essentials/minikql/comp_nodes/ut/mkql_udf_ut.cpp index 32df65881cc..27ae9271ba8 100644 --- a/yql/essentials/minikql/comp_nodes/ut/mkql_udf_ut.cpp +++ b/yql/essentials/minikql/comp_nodes/ut/mkql_udf_ut.cpp @@ -19,7 +19,7 @@ static TType* TweakUdfType(const NYql::NUdf::TStringRef& name, TType* userType, { TFunctionTypeInfoBuilder typeInfoBuilder(NYql::UnknownLangVersion, env, new TTypeInfoHelper(), - "", nullptr, {}); + "", nullptr, NYql::NUdf::TSourcePosition()); // Obtain the callable type of the particular UDF. TFunctionTypeInfo funcInfo; diff --git a/yql/essentials/minikql/compact_hash.h b/yql/essentials/minikql/compact_hash.h index bae44fa8d28..52860eb6854 100644 --- a/yql/essentials/minikql/compact_hash.h +++ b/yql/essentials/minikql/compact_hash.h @@ -80,7 +80,7 @@ public: ui32 Size; TPageListItem ListItem; - TLargeListHeader(ui32 capacity) + explicit TLargeListHeader(ui32 capacity) : Mark(LARGE_MARK) , Capacity(capacity) , Size(0u) @@ -123,7 +123,7 @@ public: TListIterator() { } - TListIterator(T* list) { + explicit TListIterator(T* list) { if (LARGE_MARK == GetMark(list)) { CurrentPage_ = EndPage_ = GetLargeListHeader(list)->Next(); Current_ = CurrentPage_->template GetList<T>(); @@ -275,7 +275,7 @@ protected: }; public: - TListPoolBase(TAlignedPagePool& pagePool) + explicit TListPoolBase(TAlignedPagePool& pagePool) : PagePool_(pagePool) { } @@ -379,7 +379,7 @@ private: static constexpr size_t PoolCount = 1 + !std::is_same<TPrimary, TSecondary>::value; public: - TListPool(TAlignedPagePool& pagePool) + explicit TListPool(TAlignedPagePool& pagePool) : TListPoolBase(pagePool) { } @@ -818,7 +818,7 @@ struct TKeyValuePair { TKeyValuePair(const TKeyValuePair&) = default; TKeyValuePair(TKeyValuePair&&) = default; - TKeyValuePair(const std::pair<TKey, TValue>& p) + explicit TKeyValuePair(const std::pair<TKey, TValue>& p) : first(p.first) , second(p.second) { @@ -875,7 +875,7 @@ public: using TBucketIter = TListPoolBase::TListIterator<const T, const TListPoolBase::TLargeListHeader>; // Full scan iterator - TIteratorImpl(const TCompactHashBase* hash) + explicit TIteratorImpl(const TCompactHashBase* hash) : Hash_(hash) , Bucket_(0) , EndBucket_(Hash_->BucketsCount_) @@ -960,7 +960,7 @@ public: using TValueIter = TListPoolBase::TListIterator<const T, const TListPoolBase::TLargeListHeader>; // Full scan iterator - TIteratorImpl(const TCompactHashBase* hash) + explicit TIteratorImpl(const TCompactHashBase* hash) : Hash_(hash) , Bucket_(0) , EndBucket_(Hash_->BucketsCount_) @@ -1060,8 +1060,8 @@ public: using TBucketIterator = TListPoolBase::TListIterator<TItemType, TListPoolBase::TLargeListHeader>; using TConstBucketIterator = TListPoolBase::TListIterator<const TItemType, const TListPoolBase::TLargeListHeader>; - TCompactHashBase(TAlignedPagePool& pagePool, size_t size = 0, const TKeyExtractor& keyExtractor = TKeyExtractor(), - const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) + explicit TCompactHashBase(TAlignedPagePool& pagePool, size_t size = 0, const TKeyExtractor& keyExtractor = TKeyExtractor(), + const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) : ListPool_(pagePool) , KeyExtractor_(keyExtractor) , KeyHash_(keyHash) @@ -1488,7 +1488,7 @@ private: using TBase = TCompactHashBase<TItem, TKey, TSelect1stUnaligned, TKeyHash, TKeyEqual>; public: - TCompactHash(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) + explicit TCompactHash(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) : TBase(pagePool, size, TSelect1stUnaligned(), keyHash, keyEqual) { } @@ -1557,7 +1557,7 @@ private: static_assert(sizeof(TStoreItem) == sizeof(TKey) + sizeof(TNode<TValue>), "Unexpected size"); public: - TCompactMultiHash(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) + explicit TCompactMultiHash(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) : TBase(pagePool, size, TSelect1stUnaligned(), keyHash, keyEqual) { } @@ -1613,7 +1613,7 @@ private: using TBase = TCompactHashBase<TKey, TKey, TIdentity, TKeyHash, TKeyEqual>; public: - TCompactHashSet(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) + explicit TCompactHashSet(TAlignedPagePool& pagePool, size_t size = 0, const TKeyHash& keyHash = TKeyHash(), const TKeyEqual& keyEqual = TKeyEqual()) : TBase(pagePool, size, TIdentity(), keyHash, keyEqual) { } diff --git a/yql/essentials/minikql/compact_hash_ut.cpp b/yql/essentials/minikql/compact_hash_ut.cpp index d503b2c545c..ff1e9ebb1a0 100644 --- a/yql/essentials/minikql/compact_hash_ut.cpp +++ b/yql/essentials/minikql/compact_hash_ut.cpp @@ -372,7 +372,7 @@ Y_UNIT_TEST(TestSetUi64) { } struct TStressHash { - TStressHash(size_t param) + explicit TStressHash(size_t param) : Param(param) { } diff --git a/yql/essentials/minikql/computation/mkql_block_impl.h b/yql/essentials/minikql/computation/mkql_block_impl.h index 9c8639f3822..3d46d574f87 100644 --- a/yql/essentials/minikql/computation/mkql_block_impl.h +++ b/yql/essentials/minikql/computation/mkql_block_impl.h @@ -46,7 +46,7 @@ public: private: class TArrowNode: public IArrowKernelComputationNode { public: - TArrowNode(const TBlockFuncNode* parent); + explicit TArrowNode(const TBlockFuncNode* parent); TStringBuf GetKernelName() const final; const arrow::compute::ScalarKernel& GetArrowKernel() const final; const std::vector<arrow::ValueDescr>& GetArgsDesc() const final; diff --git a/yql/essentials/minikql/computation/mkql_block_reader.cpp b/yql/essentials/minikql/computation/mkql_block_reader.cpp index e60302a881c..3bf22889fa0 100644 --- a/yql/essentials/minikql/computation/mkql_block_reader.cpp +++ b/yql/essentials/minikql/computation/mkql_block_reader.cpp @@ -180,7 +180,7 @@ public: template <bool Nullable> class TTupleBlockItemConverter: public IBlockItemConverter { public: - TTupleBlockItemConverter(TVector<std::unique_ptr<IBlockItemConverter>>&& children) + explicit TTupleBlockItemConverter(TVector<std::unique_ptr<IBlockItemConverter>>&& children) : Children_(std::move(children)) { Items_.resize(Children_.size()); @@ -266,7 +266,7 @@ public: class TExternalOptionalBlockItemConverter: public IBlockItemConverter { public: - TExternalOptionalBlockItemConverter(std::unique_ptr<IBlockItemConverter>&& inner) + explicit TExternalOptionalBlockItemConverter(std::unique_ptr<IBlockItemConverter>&& inner) : Inner_(std::move(inner)) { } diff --git a/yql/essentials/minikql/computation/mkql_block_transport.cpp b/yql/essentials/minikql/computation/mkql_block_transport.cpp index 8624c12981b..e1966289eb4 100644 --- a/yql/essentials/minikql/computation/mkql_block_transport.cpp +++ b/yql/essentials/minikql/computation/mkql_block_transport.cpp @@ -170,7 +170,7 @@ protected: class TBlockDeserializerBase: public IBlockDeserializer { public: - TBlockDeserializerBase(const TBlockSerializerParams& params) + explicit TBlockDeserializerBase(const TBlockSerializerParams& params) : ShouldLoadOffset_(params.ShouldSerializeOffset()) { } @@ -305,7 +305,7 @@ class TFixedSizeBlockDeserializer final: public TBlockDeserializerBase { using TBase = TBlockDeserializerBase; public: - TFixedSizeBlockDeserializer(const TBlockSerializerParams& params) + explicit TFixedSizeBlockDeserializer(const TBlockSerializerParams& params) : TBase(params) { } diff --git a/yql/essentials/minikql/computation/mkql_block_trimmer.cpp b/yql/essentials/minikql/computation/mkql_block_trimmer.cpp index dce14129fee..438bdfe41f3 100644 --- a/yql/essentials/minikql/computation/mkql_block_trimmer.cpp +++ b/yql/essentials/minikql/computation/mkql_block_trimmer.cpp @@ -17,7 +17,7 @@ namespace NKikimr::NMiniKQL { class TBlockTrimmerBase: public IBlockTrimmer { protected: - TBlockTrimmerBase(arrow::MemoryPool* pool) + explicit TBlockTrimmerBase(arrow::MemoryPool* pool) : Pool_(pool) { } @@ -52,7 +52,7 @@ protected: template <typename TLayout, bool Nullable> class TFixedSizeBlockTrimmer: public TBlockTrimmerBase { public: - TFixedSizeBlockTrimmer(arrow::MemoryPool* pool) + explicit TFixedSizeBlockTrimmer(arrow::MemoryPool* pool) : TBlockTrimmerBase(pool) { } @@ -83,7 +83,7 @@ public: template <bool Nullable> class TResourceBlockTrimmer: public TBlockTrimmerBase { public: - TResourceBlockTrimmer(arrow::MemoryPool* pool) + explicit TResourceBlockTrimmer(arrow::MemoryPool* pool) : TBlockTrimmerBase(pool) { } @@ -116,7 +116,7 @@ public: class TSingularBlockTrimmer: public TBlockTrimmerBase { public: - TSingularBlockTrimmer(arrow::MemoryPool* pool) + explicit TSingularBlockTrimmer(arrow::MemoryPool* pool) : TBlockTrimmerBase(pool) { } @@ -131,7 +131,7 @@ class TStringBlockTrimmer: public TBlockTrimmerBase { using TOffset = typename TStringType::offset_type; public: - TStringBlockTrimmer(arrow::MemoryPool* pool) + explicit TStringBlockTrimmer(arrow::MemoryPool* pool) : TBlockTrimmerBase(pool) { } @@ -197,7 +197,7 @@ public: } protected: - TTupleBlockTrimmer(arrow::MemoryPool* pool) + explicit TTupleBlockTrimmer(arrow::MemoryPool* pool) : TBlockTrimmerBase(pool) { } @@ -212,7 +212,7 @@ class TTzDateBlockTrimmer: public TTupleBlockTrimmer<Nullable> { using TDateLayout = typename NUdf::TDataType<TDate>::TLayout; public: - TTzDateBlockTrimmer(arrow::MemoryPool* pool) + explicit TTzDateBlockTrimmer(arrow::MemoryPool* pool) : TBase(pool) { this->Children_.push_back(std::make_unique<TFixedSizeBlockTrimmer<TDateLayout, false>>(pool)); diff --git a/yql/essentials/minikql/computation/mkql_computation_node.cpp b/yql/essentials/minikql/computation/mkql_computation_node.cpp index 16a1d6c5a85..11217307aae 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node.cpp @@ -168,7 +168,7 @@ void TComputationContext::UpdateUsageAdjustor(ui64 memLimit) { class TSimpleSecureParamsProvider: public NUdf::ISecureParamsProvider { public: - TSimpleSecureParamsProvider(const THashMap<TString, TString>& secureParams) + explicit TSimpleSecureParamsProvider(const THashMap<TString, TString>& secureParams) : SecureParams_(secureParams) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node.h b/yql/essentials/minikql/computation/mkql_computation_node.h index d2eae70b2fc..e51f507e166 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node.h +++ b/yql/essentials/minikql/computation/mkql_computation_node.h @@ -37,7 +37,7 @@ enum class EGraphPerProcess { }; struct TComputationOpts { - TComputationOpts(IStatsRegistry* stats) + explicit TComputationOpts(IStatsRegistry* stats) : Stats(stats) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_dict_ut.cpp b/yql/essentials/minikql/computation/mkql_computation_node_dict_ut.cpp index 7c940247b21..5ce2488447b 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_dict_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_dict_ut.cpp @@ -18,7 +18,7 @@ namespace NMiniKQL { namespace { struct TSetup { - TSetup(TScopedAlloc& alloc) + explicit TSetup(TScopedAlloc& alloc) : Alloc(alloc) { FunctionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); diff --git a/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp b/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp index caffdd5e5ab..f3ed0e6d754 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_graph_saveload_ut.cpp @@ -33,7 +33,7 @@ TComputationNodeFactory GetAuxCallableFactory() { } struct TSetup { - TSetup(TScopedAlloc& alloc) + explicit TSetup(TScopedAlloc& alloc) : Alloc(alloc) { FunctionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp b/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp index cc8655e8e2e..a34875cb860 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders.cpp @@ -36,7 +36,7 @@ class TDirectListHolder: public TComputationValue<TDirectListHolder> { public: class TIterator: public TComputationValue<TIterator> { public: - TIterator(const TDirectListHolder* parent) + explicit TIterator(const TDirectListHolder* parent) : TComputationValue(parent->GetMemInfo()) , Parent_(const_cast<TDirectListHolder*>(parent)) , Iterator_(parent->Items_) @@ -248,7 +248,7 @@ private: using TBaseValue = TComputationValue<TVectorHolderBase<TBaseVector>>; public: - TVectorHolderBase(TMemoryUsageInfo* memInfo) + explicit TVectorHolderBase(TMemoryUsageInfo* memInfo) : TBaseValue(memInfo) { } @@ -267,7 +267,7 @@ private: using TBase = TTemporaryComputationValue<TValuesIterator>; public: - TValuesIterator(const TVectorHolderBase* parent) + explicit TValuesIterator(const TVectorHolderBase* parent) : TBase(parent->GetMemInfo()) , Size_(parent->size()) , Parent_(const_cast<TVectorHolderBase*>(parent)) @@ -298,7 +298,7 @@ private: using TBase = TTemporaryComputationValue<TDictIterator>; public: - TDictIterator(const TVectorHolderBase* parent) + explicit TDictIterator(const TVectorHolderBase* parent) : TBase(parent->GetMemInfo()) , Size_(parent->size()) , Parent_(const_cast<TVectorHolderBase*>(parent)) @@ -453,7 +453,7 @@ public: class TEmptyContainerHolder: public TComputationValue<TEmptyContainerHolder> { public: - TEmptyContainerHolder(TMemoryUsageInfo* memInfo) + explicit TEmptyContainerHolder(TMemoryUsageInfo* memInfo) : TComputationValue(memInfo) , None_() { @@ -569,7 +569,7 @@ public: template <bool NoSwap> class TIterator: public TComputationValue<TIterator<NoSwap>> { public: - TIterator(const TSortedSetHolder* parent) + explicit TIterator(const TSortedSetHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<TSortedSetHolder*>(parent)) , Iterator_(Parent_->Items_.begin()) @@ -783,7 +783,7 @@ public: template <bool NoSwap> class TIterator: public TComputationValue<TIterator<NoSwap>> { public: - TIterator(const TSortedDictHolder* parent) + explicit TIterator(const TSortedDictHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<TSortedDictHolder*>(parent)) , Iterator_(Parent_->Items_.begin()) @@ -997,7 +997,7 @@ class THashedSetHolder: public TComputationValue<THashedSetHolder> { public: class TIterator: public TComputationValue<TIterator> { public: - TIterator(const THashedSetHolder* parent) + explicit TIterator(const THashedSetHolder* parent) : TComputationValue(parent->GetMemInfo()) , Parent_(const_cast<THashedSetHolder*>(parent)) , Iterator_(Parent_->Set_.begin()) @@ -1159,7 +1159,7 @@ public: AtNull, Iterator }; - TIterator(const THashedSingleFixedSetHolder* parent) + explicit TIterator(const THashedSingleFixedSetHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedSetHolder*>(parent)) , Iterator_(Parent_->Set_.begin()) @@ -1279,7 +1279,7 @@ public: AtNull, Iterator }; - TIterator(const THashedSingleFixedCompactSetHolder* parent) + explicit TIterator(const THashedSingleFixedCompactSetHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedCompactSetHolder*>(parent)) , Iterator_(Parent_->Set_.Iterate()) @@ -1391,7 +1391,7 @@ public: class TIterator: public TComputationValue<TIterator> { public: - TIterator(const THashedCompactSetHolder* parent) + explicit TIterator(const THashedCompactSetHolder* parent) : TComputationValue(parent->GetMemInfo()) , Parent_(const_cast<THashedCompactSetHolder*>(parent)) , Iterator_(Parent_->Set_.Iterate()) @@ -1501,7 +1501,7 @@ public: template <bool NoSwap> class TIterator: public TComputationValue<TIterator<NoSwap>> { public: - TIterator(const THashedCompactMapHolder* parent) + explicit TIterator(const THashedCompactMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedCompactMapHolder*>(parent)) , Iterator_(Parent_->Map_.Iterate()) @@ -1683,7 +1683,7 @@ public: template <bool NoSwap> class TIterator: public TComputationValue<TIterator<NoSwap>> { public: - TIterator(const THashedCompactMultiMapHolder* parent) + explicit TIterator(const THashedCompactMultiMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedCompactMultiMapHolder*>(parent)) , Iterator_(parent->Map_.Iterate()) @@ -1795,7 +1795,7 @@ public: template <bool NoSwap> class TIterator: public TTemporaryComputationValue<TIterator<NoSwap>> { public: - TIterator(const THashedDictHolder* parent) + explicit TIterator(const THashedDictHolder* parent) : TTemporaryComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedDictHolder*>(parent)) , Iterator_(Parent_->Map_.begin()) @@ -1961,7 +1961,7 @@ public: AtNull, Iterator }; - TIterator(const THashedSingleFixedMapHolder* parent) + explicit TIterator(const THashedSingleFixedMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedMapHolder*>(parent)) , Iterator_(Parent_->Map_.begin()) @@ -2096,7 +2096,7 @@ public: AtNull, Iterator }; - TIterator(const THashedSingleFixedCompactMapHolder* parent) + explicit TIterator(const THashedSingleFixedCompactMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedCompactMapHolder*>(parent)) , Iterator_(Parent_->Map_.Iterate()) @@ -2319,7 +2319,7 @@ public: public: class TIterator: public TComputationValue<TIterator> { public: - TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) + explicit TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) : TComputationValue<TIterator>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) , Iterator_(Parent_->NullPayloads_.cbegin()) @@ -2382,7 +2382,7 @@ public: template <bool NoSwap> class TIterator: public TComputationValue<TIterator<NoSwap>> { public: - TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) + explicit TIterator(const THashedSingleFixedCompactMultiMapHolder* parent) : TComputationValue<TIterator<NoSwap>>(parent->GetMemInfo()) , Parent_(const_cast<THashedSingleFixedCompactMultiMapHolder*>(parent)) , Iterator_(parent->Map_.Iterate()) diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders.h b/yql/essentials/minikql/computation/mkql_computation_node_holders.h index 100f9d94ac2..4909cf6d3fd 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders.h @@ -694,7 +694,7 @@ public: private: class TIterator: public TTemporaryComputationValue<TIterator> { public: - TIterator(const TDirectArrayHolderInplace* parent) + explicit TIterator(const TDirectArrayHolderInplace* parent) : TTemporaryComputationValue(parent->GetMemInfo()) , Parent_(const_cast<TDirectArrayHolderInplace*>(parent)) { @@ -727,7 +727,7 @@ private: class TKeysIterator: public TTemporaryComputationValue<TKeysIterator> { public: - TKeysIterator(const TDirectArrayHolderInplace& parent) + explicit TKeysIterator(const TDirectArrayHolderInplace& parent) : TTemporaryComputationValue(parent.GetMemInfo()) , Size_(parent.GetSize()) { @@ -1083,7 +1083,7 @@ template <bool SupportEqual, bool SupportHash, bool SupportLess> class TKeyTypeContanerHelper { public: TKeyTypeContanerHelper() = default; - TKeyTypeContanerHelper(const TType* type) { + explicit TKeyTypeContanerHelper(const TType* type) { bool encoded; bool useIHash; GetDictionaryKeyTypes(type, KeyTypes_, IsTuple_, encoded, useIHash); @@ -1144,7 +1144,7 @@ private: template <class TObject> class TMutableObjectOverBoxedValue { public: - TMutableObjectOverBoxedValue(TComputationMutables& mutables) + explicit TMutableObjectOverBoxedValue(TComputationMutables& mutables) : ObjectIndex_(mutables.CurValueIndex++) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders_ut.cpp b/yql/essentials/minikql/computation/mkql_computation_node_holders_ut.cpp index db82741c9c3..1f63c5cd89e 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders_ut.cpp @@ -23,7 +23,7 @@ struct TSetup { struct TTestedSets { TTestedSets() = default; - TTestedSets(const TType* type) + explicit TTestedSets(const TType* type) : HashSetHelper(type) , HashSet(0, HashSetHelper.GetValueHash(), HashSetHelper.GetValueEqual()) , CmpSetHelper(type) diff --git a/yql/essentials/minikql/computation/mkql_computation_node_impl.h b/yql/essentials/minikql/computation/mkql_computation_node_impl.h index 3cd3624533a..35d3dfdeecf 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_impl.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_impl.h @@ -128,7 +128,7 @@ private: class TExternalComputationNode: public TStatefulComputationNode<IComputationExternalNode> { public: - TExternalComputationNode(TComputationMutables& mutables, EValueRepresentation kind = EValueRepresentation::Any); + explicit TExternalComputationNode(TComputationMutables& mutables, EValueRepresentation kind = EValueRepresentation::Any); protected: NUdf::TUnboxedValue GetValue(TComputationContext& compCtx) const override; @@ -219,7 +219,7 @@ private: } protected: - TStatefulSourceComputationNode(TComputationMutables& mutables, EValueRepresentation kind = EValueRepresentation::Any) + explicit TStatefulSourceComputationNode(TComputationMutables& mutables, EValueRepresentation kind = EValueRepresentation::Any) : TStatefulComputationNode(mutables, kind) { } @@ -379,7 +379,7 @@ private: template <typename TDerived, typename IFlowInterface> class TFlowBaseComputationNode: public TRefCountedComputationNode<IFlowInterface> { protected: - TFlowBaseComputationNode(const IComputationNode* source) + explicit TFlowBaseComputationNode(const IComputationNode* source) : Source_(source) , UpvaluesCollected_(false) { @@ -741,7 +741,7 @@ template <typename TDerived> class TWideFlowBaseComputationNode: public TFlowBaseComputationNode<TDerived, IComputationWideFlowNode>, protected TWideFlowBaseComputationNodeBase { protected: - TWideFlowBaseComputationNode(const IComputationNode* source) + explicit TWideFlowBaseComputationNode(const IComputationNode* source) : TFlowBaseComputationNode<TDerived, IComputationWideFlowNode>(source) { } @@ -769,7 +769,7 @@ template <typename TDerived> class TStatelessWideFlowComputationNode: public TWideFlowBaseComputationNode<TDerived>, protected TStatelessWideFlowComputationNodeBase { protected: - TStatelessWideFlowComputationNode(const IComputationNode* source) + explicit TStatelessWideFlowComputationNode(const IComputationNode* source) : TWideFlowBaseComputationNode<TDerived>(source) { } @@ -964,7 +964,7 @@ protected: { } - TDecoratorComputationNode(IComputationNode* node) + explicit TDecoratorComputationNode(IComputationNode* node) : TDecoratorComputationNodeBase(node, node->GetRepresentation()) { } @@ -1094,7 +1094,7 @@ private: public: template <typename... Args> - TComputationValueBaseNotSupportedStub(Args&&... args) + explicit TComputationValueBaseNotSupportedStub(Args&&... args) : TBase(std::forward<Args>(args)...) { } @@ -1160,7 +1160,7 @@ private: public: template <typename... Args> - TComputationValueBase(Args&&... args) + explicit TComputationValueBase(Args&&... args) : TBase(std::forward<Args>(args)...) { } @@ -1197,7 +1197,7 @@ protected: public: template <typename... Args> - TComputationValueImpl(TMemoryUsageInfo* memInfo, Args&&... args) + explicit TComputationValueImpl(TMemoryUsageInfo* memInfo, Args&&... args) : TBase(std::forward<Args>(args)...) { #ifndef NDEBUG @@ -1299,7 +1299,7 @@ template <typename T> class TBoxedData: public NUdf::TBoxedValue { public: template <typename... Args> - TBoxedData(Args&&... args) + explicit TBoxedData(Args&&... args) : Data_(std::forward<Args>(args)...) { } @@ -1319,7 +1319,7 @@ private: template <typename T> class TMutableDataOnContext: private TNonCopyable { public: - TMutableDataOnContext(TComputationMutables& mutables) + explicit TMutableDataOnContext(TComputationMutables& mutables) : Index_(mutables.CurValueIndex++) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_list.h b/yql/essentials/minikql/computation/mkql_computation_node_list.h index 8833f649eb9..a4c03f3516f 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_list.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_list.h @@ -31,7 +31,7 @@ public: return ptr; } - TListChunk(ui64 size) + explicit TListChunk(ui64 size) : Magic_(TListChunkMagic) , Refs_(1) , DataEnd_(DataBegin() + size) @@ -126,7 +126,7 @@ public: { } - TIterator(const TListRepresentation& owner) + explicit TIterator(const TListRepresentation& owner) : Owner(&owner) , Position(owner.Begin_) { @@ -173,13 +173,13 @@ public: { } - TReverseIterator(const TListRepresentation& owner) + explicit TReverseIterator(const TListRepresentation& owner) : Owner_(&owner) , Position_(owner.End_) { } - TReverseIterator(const TIterator& other) + explicit TReverseIterator(const TIterator& other) : Owner_(other.Owner) , Position_(other.Position) { @@ -296,7 +296,7 @@ public: *Begin_ = std::move(element); } - TListRepresentation(T&& element) + explicit TListRepresentation(T&& element) { FromSingleElement(std::move(element)); } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_pack.cpp b/yql/essentials/minikql/computation/mkql_computation_node_pack.cpp index 460f19c6eb4..3f8f72bb653 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_pack.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_pack.cpp @@ -82,7 +82,7 @@ public: StoreOffsetsForEachChildData = 1 << 1, }; - TBlockTransportFlags(ui64 data) + explicit TBlockTransportFlags(ui64 data) : Data_(data) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h index efd3ad63120..81caaabd3a7 100644 --- a/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h +++ b/yql/essentials/minikql/computation/mkql_computation_pattern_cache.h @@ -36,7 +36,7 @@ struct TPatternCacheEntry { SizeForCache = Alloc.GetAllocated(); } - TPatternCacheEntry(bool useAlloc = true) + explicit TPatternCacheEntry(bool useAlloc = true) : Alloc(__LOCATION__) , Env(Alloc) , UseAlloc(useAlloc) @@ -90,8 +90,8 @@ public: // TODO(YQL-20086): Migrate YDB to TConfig using Config = TConfig; - TComputationPatternLRUCache(const TConfig& configuration, - NMonitoring::TDynamicCounterPtr counters = MakeIntrusive<NMonitoring::TDynamicCounters>()); + explicit TComputationPatternLRUCache(const TConfig& configuration, + NMonitoring::TDynamicCounterPtr counters = MakeIntrusive<NMonitoring::TDynamicCounters>()); ~TComputationPatternLRUCache(); static TPatternCacheEntryPtr CreateCacheEntry(bool useAlloc = true) { diff --git a/yql/essentials/minikql/computation/mkql_custom_list.h b/yql/essentials/minikql/computation/mkql_custom_list.h index 66cb20f1fc6..40a97a98878 100644 --- a/yql/essentials/minikql/computation/mkql_custom_list.h +++ b/yql/essentials/minikql/computation/mkql_custom_list.h @@ -7,7 +7,7 @@ namespace NMiniKQL { class TCustomListValue: public TComputationValue<TCustomListValue> { public: - TCustomListValue(TMemoryUsageInfo* memInfo) + explicit TCustomListValue(TMemoryUsageInfo* memInfo) : TComputationValue(memInfo) , Length(Length_) , HasItems(HasItems_) diff --git a/yql/essentials/minikql/computation/mkql_validate.cpp b/yql/essentials/minikql/computation/mkql_validate.cpp index 7953d60e4cb..b23b9a77172 100644 --- a/yql/essentials/minikql/computation/mkql_validate.cpp +++ b/yql/essentials/minikql/computation/mkql_validate.cpp @@ -19,7 +19,7 @@ struct TLazyVerifyListValue; template <class TValidateErrorPolicy> struct TLazyVerifyListIterator: public TBoxedValue { - TLazyVerifyListIterator(const TLazyVerifyListValue<TValidateErrorPolicy>& lazyList, ui64 index = 0) + explicit TLazyVerifyListIterator(const TLazyVerifyListValue<TValidateErrorPolicy>& lazyList, ui64 index = 0) : LazyList_(lazyList) , OrigIter_(TBoxedValueAccessor::GetListIterator(*lazyList.Orig)) , Index_(index) @@ -144,7 +144,7 @@ private: template <class TValidateErrorPolicy, bool Keys> struct TLazyVerifyDictIterator: public TBoxedValue { - TLazyVerifyDictIterator(const TLazyVerifyDictValue<TValidateErrorPolicy>& lazyDict, ui64 index = 0) + explicit TLazyVerifyDictIterator(const TLazyVerifyDictValue<TValidateErrorPolicy>& lazyDict, ui64 index = 0) : LazyDict_(lazyDict) , OrigIter_((Keys ? &TBoxedValueAccessor::GetKeysIterator : &TBoxedValueAccessor::GetDictIterator)(*LazyDict_.Orig)) , Index_(index) diff --git a/yql/essentials/minikql/computation/mkql_validate_ut.cpp b/yql/essentials/minikql/computation/mkql_validate_ut.cpp index 57018f54fad..a0f5506c608 100644 --- a/yql/essentials/minikql/computation/mkql_validate_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_validate_ut.cpp @@ -69,7 +69,7 @@ private: template <class TContainer, ui32 TIndexDictBrokenHole = RAW_INDEX_NO_HOLE, bool TNoDictIndex = false> struct TListRef: public NUdf::TBoxedValue { - TListRef(const TContainer& listRef, ui32 holePos = RAW_INDEX_NO_HOLE) + explicit TListRef(const TContainer& listRef, ui32 holePos = RAW_INDEX_NO_HOLE) : ListRef_(listRef) , HolePos_(holePos) { @@ -272,7 +272,7 @@ private: template <class TStructType> struct TBrokenStructBoxedValue: public NUdf::TBoxedValue { - TBrokenStructBoxedValue(const TStructType& data, ui32 holePos = RAW_INDEX_NO_HOLE) + explicit TBrokenStructBoxedValue(const TStructType& data, ui32 holePos = RAW_INDEX_NO_HOLE) : Struct_(data) , HolePos_(holePos) { @@ -395,7 +395,7 @@ private: struct TThrowerValue: public NUdf::TBoxedValue { static long Count; - TThrowerValue(NUdf::IBoxedValuePtr&& owner = NUdf::IBoxedValuePtr()) + explicit TThrowerValue(NUdf::IBoxedValuePtr&& owner = NUdf::IBoxedValuePtr()) : Owner_(std::move(owner)) { ++Count; @@ -713,7 +713,7 @@ void ProcessSimpleUdfFunc(const char* udfFuncName, BuildArgsFunc argsFunc = Buil TStringBuf typeConfig; TStatus status = functionRegistry->FindFunctionTypeInfo( NYql::UnknownLangVersion, env, typeInfoHelper, nullptr, udfFuncName, - userType, typeConfig, flags, {}, nullptr, nullptr, &funcInfo); + userType, typeConfig, flags, NYql::NUdf::TSourcePosition(), nullptr, nullptr, &funcInfo); MKQL_ENSURE(status.IsOk(), status.GetError()); auto type = funcInfo.FunctionType->GetReturnType(); fullValidateFunc(value, builder, type); @@ -767,7 +767,7 @@ std::vector<TRuntimeNode> MakeCallableInArgs(ui32 testVal, TProgramBuilder& pgmB NUdf::ITypeInfoHelper::TPtr typeInfoHelper(new TTypeInfoHelper); TStatus status = functionRegistry.FindFunctionTypeInfo( NYql::UnknownLangVersion, pgmBuilder.GetTypeEnvironment(), typeInfoHelper, nullptr, - udfFuncName, userType, typeConfig, flags, {}, nullptr, nullptr, &funcInfo); + udfFuncName, userType, typeConfig, flags, NYql::NUdf::TSourcePosition(), nullptr, nullptr, &funcInfo); MKQL_ENSURE(status.IsOk(), status.GetError()); auto callable = pgmBuilder.Udf(udfFuncName); return std::vector<TRuntimeNode>{callable, pgmBuilder.NewDataLiteral(testVal)}; diff --git a/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp b/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp index fd826aecbc4..d01d00d02e1 100644 --- a/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp +++ b/yql/essentials/minikql/computation/mkql_value_builder_ut.cpp @@ -44,7 +44,7 @@ public: , HolderFactory_(Alloc_.Ref(), MemInfo_, FunctionRegistry_.Get()) , Builder_(HolderFactory_, NUdf::EValidatePolicy::Exception) , TypeInfoHelper_(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, {}) + , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, TSourcePosition()) { BoolOid_ = NYql::NPg::LookupType("bool").TypeId; } diff --git a/yql/essentials/minikql/computation/presort.h b/yql/essentials/minikql/computation/presort.h index 1993260bc99..2ece83cdbae 100644 --- a/yql/essentials/minikql/computation/presort.h +++ b/yql/essentials/minikql/computation/presort.h @@ -56,7 +56,7 @@ class THolderFactory; class TGenericPresortEncoder { public: - TGenericPresortEncoder(TType* type); + explicit TGenericPresortEncoder(TType* type); TStringBuf Encode(const NUdf::TUnboxedValue& value, bool desc); // user must copy NUdf::TUnboxedValue Decode(TStringBuf buf, bool desc, const THolderFactory& factory); diff --git a/yql/essentials/minikql/dom/node.h b/yql/essentials/minikql/dom/node.h index 90f2f959480..a08d949714b 100644 --- a/yql/essentials/minikql/dom/node.h +++ b/yql/essentials/minikql/dom/node.h @@ -59,7 +59,7 @@ public: template <bool NoSwap> class TIterator: public TManagedBoxedValue { public: - TIterator(const TMapNode* parent); + explicit TIterator(const TMapNode* parent); private: bool Skip() final; @@ -157,7 +157,7 @@ inline TUnboxedValuePod MakeDict(const TPair* items, ui32 count) { } struct TDebugPrinter { - TDebugPrinter(const TUnboxedValuePod& node); + explicit TDebugPrinter(const TUnboxedValuePod& node); class IOutputStream& Out(class IOutputStream& o) const; const TUnboxedValuePod& Node; }; diff --git a/yql/essentials/minikql/jsonpath/executor.h b/yql/essentials/minikql/jsonpath/executor.h index c03c8f7bf25..cb994fd871c 100644 --- a/yql/essentials/minikql/jsonpath/executor.h +++ b/yql/essentials/minikql/jsonpath/executor.h @@ -25,11 +25,11 @@ using TJsonNodes = TSmallVec<TValue>; class TResult { public: - TResult(TJsonNodes&& nodes); + TResult(TJsonNodes&& nodes); // NOLINT(google-explicit-constructor) - TResult(const TJsonNodes& nodes); + TResult(const TJsonNodes& nodes); // NOLINT(google-explicit-constructor) - TResult(TIssue&& issue); + TResult(TIssue&& issue); // NOLINT(google-explicit-constructor) const TJsonNodes& GetNodes() const; diff --git a/yql/essentials/minikql/jsonpath/parser/ast_builder.h b/yql/essentials/minikql/jsonpath/parser/ast_builder.h index 6c4615484d4..535d5c70f09 100644 --- a/yql/essentials/minikql/jsonpath/parser/ast_builder.h +++ b/yql/essentials/minikql/jsonpath/parser/ast_builder.h @@ -8,7 +8,7 @@ namespace NYql::NJsonPath { class TAstBuilder { public: - TAstBuilder(TIssues& issues); + explicit TAstBuilder(TIssues& issues); TAstNodePtr Build(const NJsonPathGenerated::TJsonPathParserAST& ast); diff --git a/yql/essentials/minikql/jsonpath/parser/binary.h b/yql/essentials/minikql/jsonpath/parser/binary.h index 19abbf0769d..a47c879ab35 100644 --- a/yql/essentials/minikql/jsonpath/parser/binary.h +++ b/yql/essentials/minikql/jsonpath/parser/binary.h @@ -221,7 +221,7 @@ private: class TJsonPathReader { public: - TJsonPathReader(const TJsonPathPtr path); + explicit TJsonPathReader(const TJsonPathPtr path); const TJsonPathItem& ReadFirst(); diff --git a/yql/essentials/minikql/jsonpath/parser/type_check.h b/yql/essentials/minikql/jsonpath/parser/type_check.h index f7a3adf047e..51fb0fd8d13 100644 --- a/yql/essentials/minikql/jsonpath/parser/type_check.h +++ b/yql/essentials/minikql/jsonpath/parser/type_check.h @@ -6,7 +6,7 @@ namespace NYql::NJsonPath { class TJsonPathTypeChecker: public IAstNodeVisitor { public: - TJsonPathTypeChecker(TIssues& Issues); + explicit TJsonPathTypeChecker(TIssues& Issues); void VisitRoot(const TRootNode& node) override; diff --git a/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp b/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp index a1519aa5a81..6816ca489ff 100644 --- a/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp +++ b/yql/essentials/minikql/jsonpath/rewrapper/hyperscan/hyperscan.cpp @@ -11,7 +11,7 @@ namespace { class THyperscan: public IRe { public: - THyperscan(::NHyperscan::TDatabase&& db) + explicit THyperscan(::NHyperscan::TDatabase&& db) : Database_(std::move(db)) { } diff --git a/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp b/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp index 2c97b85123b..494d2f875dc 100644 --- a/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp +++ b/yql/essentials/minikql/jsonpath/rewrapper/re2/re2.cpp @@ -33,7 +33,7 @@ public: re2->set_flags(flags); } - TRe2(const TSerialization& proto) + explicit TRe2(const TSerialization& proto) : Regexp_(StringPiece(proto.GetRe2().GetRegexp().data(), proto.GetRe2().GetRegexp().size()), CreateOptions(proto.GetRe2().GetRegexp(), proto.GetRe2().GetFlags())) , RawRegexp_(proto) diff --git a/yql/essentials/minikql/mkql_alloc.h b/yql/essentials/minikql/mkql_alloc.h index bb28f7efddb..d5b91f3d216 100644 --- a/yql/essentials/minikql/mkql_alloc.h +++ b/yql/essentials/minikql/mkql_alloc.h @@ -286,7 +286,7 @@ private: class TPagedArena { public: - TPagedArena(TAlignedPagePool* pagePool) noexcept + explicit TPagedArena(TAlignedPagePool* pagePool) noexcept : PagePool_(pagePool) , CurrentPages_(TAllocState::EmptyCurrentPages) { @@ -578,9 +578,11 @@ struct TMKQLAllocator { TMKQLAllocator() noexcept = default; ~TMKQLAllocator() noexcept = default; - template <typename U> + // Almost a copy costructor. + template <typename U> // NOLINTNEXTLINE(google-explicit-constructor) TMKQLAllocator(const TMKQLAllocator<U, MemoryPool>&) noexcept { } + template <typename U> struct rebind { // NOLINT(readability-identifier-naming) typedef TMKQLAllocator<U, MemoryPool> other; @@ -622,7 +624,7 @@ struct TMKQLHugeAllocator { ~TMKQLHugeAllocator() noexcept = default; template <typename U> - TMKQLHugeAllocator(const TMKQLHugeAllocator<U>&) noexcept { + explicit TMKQLHugeAllocator(const TMKQLHugeAllocator<U>&) noexcept { } template <typename U> @@ -670,7 +672,7 @@ public: class TIterator; class TConstIterator; - TPagedList(TAlignedPagePool& pool) + explicit TPagedList(TAlignedPagePool& pool) : Pool_(pool) , IndexInLastPage_(OBJECTS_PER_PAGE) { diff --git a/yql/essentials/minikql/mkql_function_metadata.h b/yql/essentials/minikql/mkql_function_metadata.h index af4419b4c6b..e08692a2948 100644 --- a/yql/essentials/minikql/mkql_function_metadata.h +++ b/yql/essentials/minikql/mkql_function_metadata.h @@ -61,7 +61,7 @@ class TKernelFamily { public: const arrow::compute::FunctionOptions* FunctionOptions; - TKernelFamily(const arrow::compute::FunctionOptions* functionOptions = nullptr) + explicit TKernelFamily(const arrow::compute::FunctionOptions* functionOptions = nullptr) : FunctionOptions(functionOptions) { } @@ -118,7 +118,7 @@ using TKernelFamilyMap = std::unordered_map<TString, std::unique_ptr<TKernelFami class TKernelFamilyBase: public TKernelFamily { public: - TKernelFamilyBase(const arrow::compute::FunctionOptions* functionOptions = nullptr); + explicit TKernelFamilyBase(const arrow::compute::FunctionOptions* functionOptions = nullptr); const TKernel* FindKernel(const NUdf::TDataTypeId* argTypes, size_t argTypesCount, NUdf::TDataTypeId returnType) const final; TVector<const TKernel*> GetAllKernels() const final; diff --git a/yql/essentials/minikql/mkql_function_registry.cpp b/yql/essentials/minikql/mkql_function_registry.cpp index e9ae5c67d80..d08511918f5 100644 --- a/yql/essentials/minikql/mkql_function_registry.cpp +++ b/yql/essentials/minikql/mkql_function_registry.cpp @@ -109,7 +109,7 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry { }; public: - TMutableFunctionRegistry(IBuiltinFunctionRegistry::TPtr builtins) + explicit TMutableFunctionRegistry(IBuiltinFunctionRegistry::TPtr builtins) : Builtins_(std::move(builtins)) { } @@ -333,7 +333,7 @@ public: TFunctionsMap Functions; class TFuncDescriptor: public NUdf::IFunctionDescriptor { public: - TFuncDescriptor(TFunctionProperties& properties) + explicit TFuncDescriptor(TFunctionProperties& properties) : Properties_(properties) { } @@ -398,7 +398,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TBuiltinsWrapper: public IFunctionRegistry { public: - TBuiltinsWrapper(IBuiltinFunctionRegistry::TPtr&& builtins) + explicit TBuiltinsWrapper(IBuiltinFunctionRegistry::TPtr&& builtins) : Builtins_(std::move(builtins)) { } diff --git a/yql/essentials/minikql/mkql_node.h b/yql/essentials/minikql/mkql_node.h index 1104e5d0880..7d7b0ca3d6d 100644 --- a/yql/essentials/minikql/mkql_node.h +++ b/yql/essentials/minikql/mkql_node.h @@ -119,7 +119,7 @@ public: bool IsMergeable() const; protected: - TNode(TType* type) + explicit TNode(TType* type) : Type_(type) , Cookie_(0) { @@ -265,7 +265,7 @@ public: bool IsConvertableTo(const TSingularType<SingularKind>& typeToCompare, bool ignoreTagged = false) const; private: - TSingularType(TTypeType* type) + explicit TSingularType(TTypeType* type) : TType(SingularKind, type, true) { } @@ -298,7 +298,7 @@ public: } private: - TSingular(const TTypeEnvironment& env) + explicit TSingular(const TTypeEnvironment& env) : TNode(GetTypeOfSingular<SingularKind>(env)) { } @@ -348,7 +348,7 @@ public: return (size_t)StrBuf_.data(); } - operator bool() const { + explicit operator bool() const { return (bool)StrBuf_; } @@ -887,7 +887,7 @@ public: private: TOptionalLiteral(TRuntimeNode item, TOptionalType* type, bool validate = true); - TOptionalLiteral(TOptionalType* type, bool validate = true); + explicit TOptionalLiteral(TOptionalType* type, bool validate = true); using TNode::Equals; bool Equals(const TOptionalLiteral& nodeToCompare) const; @@ -1067,7 +1067,7 @@ private: class TCallablePayload: public NUdf::ICallablePayload { public: - TCallablePayload(NMiniKQL::TNode* node); + explicit TCallablePayload(NMiniKQL::TNode* node); NUdf::TStringRef GetPayload() const override { return Payload_; @@ -1174,7 +1174,7 @@ public: bool IsConvertableTo(const TAnyType& typeToCompare, bool ignoreTagged = false) const; private: - TAnyType(TTypeType* type) + explicit TAnyType(TTypeType* type) : TType(EKind::Any, type, false) { } @@ -1206,7 +1206,7 @@ public: void SetItem(TRuntimeNode newItem); private: - TAny(TAnyType* type) + explicit TAny(TAnyType* type) : TNode(type) { } diff --git a/yql/essentials/minikql/mkql_node_builder.h b/yql/essentials/minikql/mkql_node_builder.h index 0beefb0ff94..c897f8434a8 100644 --- a/yql/essentials/minikql/mkql_node_builder.h +++ b/yql/essentials/minikql/mkql_node_builder.h @@ -28,7 +28,7 @@ TBlockType::EShape GetResultShape(const TVector<TType*>& types); class TTupleLiteralBuilder { public: - TTupleLiteralBuilder(const TTypeEnvironment& env); + explicit TTupleLiteralBuilder(const TTypeEnvironment& env); TTupleLiteralBuilder(const TTupleLiteralBuilder&) = default; TTupleLiteralBuilder& operator=(const TTupleLiteralBuilder&) = default; void Reserve(ui32 size); @@ -44,7 +44,7 @@ private: class TStructTypeBuilder { public: - TStructTypeBuilder(const TTypeEnvironment& env); + explicit TStructTypeBuilder(const TTypeEnvironment& env); TStructTypeBuilder(const TStructTypeBuilder&) = default; TStructTypeBuilder& operator=(const TStructTypeBuilder&) = default; void Reserve(ui32 size); @@ -75,7 +75,7 @@ private: class TStructLiteralBuilder { public: - TStructLiteralBuilder(const TTypeEnvironment& env); + explicit TStructLiteralBuilder(const TTypeEnvironment& env); TStructLiteralBuilder(const TStructLiteralBuilder&) = default; TStructLiteralBuilder& operator=(const TStructLiteralBuilder&) = default; void Reserve(ui32 size); diff --git a/yql/essentials/minikql/mkql_node_printer.cpp b/yql/essentials/minikql/mkql_node_printer.cpp index f2dce2a943d..cefd31056f0 100644 --- a/yql/essentials/minikql/mkql_node_printer.cpp +++ b/yql/essentials/minikql/mkql_node_printer.cpp @@ -13,7 +13,7 @@ class TPrintVisitor: public INodeVisitor { public: struct TIndentScope { - TIndentScope(TPrintVisitor* self) + explicit TIndentScope(TPrintVisitor* self) : Self(self) { ++Self->Indent_; @@ -26,7 +26,7 @@ public: TPrintVisitor* Self; }; - TPrintVisitor(bool singleLine) + explicit TPrintVisitor(bool singleLine) : SingleLine_(singleLine) , Indent_(0) { diff --git a/yql/essentials/minikql/mkql_node_serialization.cpp b/yql/essentials/minikql/mkql_node_serialization.cpp index 9e5184e6a51..9420554a029 100644 --- a/yql/essentials/minikql/mkql_node_serialization.cpp +++ b/yql/essentials/minikql/mkql_node_serialization.cpp @@ -100,7 +100,7 @@ public: class TPreVisitor: public INodeVisitor { public: - TPreVisitor(TWriter& owner) + explicit TPreVisitor(TWriter& owner) : Owner_(owner) , IsProcessed0_(false) { @@ -588,7 +588,7 @@ public: class TPostVisitor: public INodeVisitor { public: - TPostVisitor(TWriter& owner) + explicit TPostVisitor(TWriter& owner) : Owner_(owner) { } diff --git a/yql/essentials/minikql/mkql_program_builder.cpp b/yql/essentials/minikql/mkql_program_builder.cpp index 2788580a86f..2d94c781631 100644 --- a/yql/essentials/minikql/mkql_program_builder.cpp +++ b/yql/essentials/minikql/mkql_program_builder.cpp @@ -4687,7 +4687,7 @@ TRuntimeNode TProgramBuilder::Udf( TFunctionTypeInfo funcInfo; TStatus status = FunctionRegistry_.FindFunctionTypeInfo( - LangVer_, Env_, TypeInfoHelper_, nullptr, funcName, userType, typeConfig, flags, {}, nullptr, nullptr, &funcInfo); + LangVer_, Env_, TypeInfoHelper_, nullptr, funcName, userType, typeConfig, flags, NYql::NUdf::TSourcePosition(), nullptr, nullptr, &funcInfo); MKQL_ENSURE(status.IsOk(), status.GetError()); if (funcInfo.MinLangVer != NYql::UnknownLangVersion && LangVer_ != NYql::UnknownLangVersion && LangVer_ < funcInfo.MinLangVer) { throw yexception() << "UDF " << funcName << " is not available in given language version yet"; diff --git a/yql/essentials/minikql/mkql_stats_registry.h b/yql/essentials/minikql/mkql_stats_registry.h index 8044abf9cac..b00a92a1587 100644 --- a/yql/essentials/minikql/mkql_stats_registry.h +++ b/yql/essentials/minikql/mkql_stats_registry.h @@ -113,7 +113,7 @@ IStatsRegistryPtr CreateDefaultStatsRegistry(); class TStatTimerBase { public: - TStatTimerBase(const TStatKey& key) + explicit TStatTimerBase(const TStatKey& key) : Key_(key) , Total_(0) , Start_(0) @@ -137,7 +137,7 @@ protected: class TStatTimer: public TStatTimerBase { public: - TStatTimer(const TStatKey& key) + explicit TStatTimer(const TStatKey& key) : TStatTimerBase(key) { } @@ -153,7 +153,7 @@ public: class TSamplingStatTimer: public TStatTimerBase { public: - TSamplingStatTimer(const TStatKey& key, ui64 frequency = 100) + explicit TSamplingStatTimer(const TStatKey& key, ui64 frequency = 100) : TStatTimerBase(key) , Frequency_(frequency) { diff --git a/yql/essentials/minikql/mkql_terminator.h b/yql/essentials/minikql/mkql_terminator.h index 113b3b4c722..f9a743cc8b2 100644 --- a/yql/essentials/minikql/mkql_terminator.h +++ b/yql/essentials/minikql/mkql_terminator.h @@ -24,7 +24,7 @@ public: }; struct TBindTerminator: private TNonCopyable { - TBindTerminator(ITerminator* terminator); + explicit TBindTerminator(ITerminator* terminator); ~TBindTerminator(); static thread_local ITerminator* Terminator; diff --git a/yql/essentials/minikql/mkql_type_builder.cpp b/yql/essentials/minikql/mkql_type_builder.cpp index f793144468d..8b02fb05fbe 100644 --- a/yql/essentials/minikql/mkql_type_builder.cpp +++ b/yql/essentials/minikql/mkql_type_builder.cpp @@ -106,7 +106,7 @@ public: ////////////////////////////////////////////////////////////////////////////// class TOptionalTypeBuilder: public NUdf::IOptionalTypeBuilder { public: - TOptionalTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TOptionalTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -143,7 +143,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TListTypeBuilder: public NUdf::IListTypeBuilder { public: - TListTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TListTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -179,7 +179,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TStreamTypeBuilder: public NUdf::IStreamTypeBuilder { public: - TStreamTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TStreamTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -215,7 +215,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TDictTypeBuilder: public NUdf::IDictTypeBuilder { public: - TDictTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TDictTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -283,7 +283,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TSetTypeBuilder: public NUdf::ISetTypeBuilder { public: - TSetTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TSetTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -461,7 +461,7 @@ private: ////////////////////////////////////////////////////////////////////////////// class TVariantTypeBuilder: public NUdf::IVariantTypeBuilder { public: - TVariantTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) + explicit TVariantTypeBuilder(const NMiniKQL::TFunctionTypeInfoBuilder& parent) : Parent_(parent) { } @@ -2033,7 +2033,7 @@ NUdf::TCounter TFunctionTypeInfoBuilder::GetCounter(const NUdf::TStringRef& name return CountersProvider_->GetCounter(ModuleName_, name, deriv); } - return {}; + return NUdf::TCounter(); } NUdf::TScopedProbe TFunctionTypeInfoBuilder::GetScopedProbe(const NUdf::TStringRef& name) { @@ -2041,7 +2041,7 @@ NUdf::TScopedProbe TFunctionTypeInfoBuilder::GetScopedProbe(const NUdf::TStringR return CountersProvider_->GetScopedProbe(ModuleName_, name); } - return {}; + return NUdf::TScopedProbe(); } NUdf::TSourcePosition TFunctionTypeInfoBuilder::GetSourcePosition() { diff --git a/yql/essentials/minikql/mkql_type_builder.h b/yql/essentials/minikql/mkql_type_builder.h index a9c3f221714..8aacd7a4b3a 100644 --- a/yql/essentials/minikql/mkql_type_builder.h +++ b/yql/essentials/minikql/mkql_type_builder.h @@ -52,7 +52,7 @@ std::shared_ptr<arrow::StructType> MakeTzDateArrowType() { class TArrowType: public NUdf::IArrowType { public: - TArrowType(const std::shared_ptr<arrow::DataType>& type) + explicit TArrowType(const std::shared_ptr<arrow::DataType>& type) : Type_(type) { } @@ -280,7 +280,7 @@ ui64 CalcMaxBlockLength(T beginIt, T endIt, const NUdf::ITypeInfoHelper& helper) class TTypeBuilder: public TMoveOnly { public: - TTypeBuilder(const TTypeEnvironment& env) + explicit TTypeBuilder(const TTypeEnvironment& env) : Env_(env) , Env(env) , UseNullType(UseNullType_) diff --git a/yql/essentials/minikql/mkql_type_builder_ut.cpp b/yql/essentials/minikql/mkql_type_builder_ut.cpp index 6f4c2fa9b27..8190738818c 100644 --- a/yql/essentials/minikql/mkql_type_builder_ut.cpp +++ b/yql/essentials/minikql/mkql_type_builder_ut.cpp @@ -16,7 +16,7 @@ public: : Alloc_(__LOCATION__) , Env_(Alloc_) , TypeInfoHelper_(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, {}) + , FunctionTypeInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, NYql::NUdf::TSourcePosition()) { } @@ -373,7 +373,7 @@ struct TLogMessage { }; struct TLogProviderSetup { - TLogProviderSetup(bool withoutLog = false) + explicit TLogProviderSetup(bool withoutLog = false) : Alloc(__LOCATION__) , Env(Alloc) , TypeInfoHelper(new TTypeInfoHelper()) @@ -381,7 +381,7 @@ struct TLogProviderSetup { [this](const NUdf::TStringRef& component, NUdf::ELogLevel level, const NUdf::TStringRef& message) { Messages.push_back({TString(component), level, TString(message)}); })) - , FunctionTypeInfoBuilder(NYql::UnknownLangVersion, Env, TypeInfoHelper, "module", nullptr, {}, nullptr, withoutLog ? nullptr : LogProvider.Get()) + , FunctionTypeInfoBuilder(NYql::UnknownLangVersion, Env, TypeInfoHelper, "module", nullptr, NYql::NUdf::TSourcePosition(), nullptr, withoutLog ? nullptr : LogProvider.Get()) { } diff --git a/yql/essentials/minikql/mkql_utils.h b/yql/essentials/minikql/mkql_utils.h index 78909395b63..349bb671faf 100644 --- a/yql/essentials/minikql/mkql_utils.h +++ b/yql/essentials/minikql/mkql_utils.h @@ -44,7 +44,7 @@ public: private: inline TStatus() = default; - inline TStatus(TString&& error) + inline explicit TStatus(TString&& error) : Error_(std::move(error)) { } diff --git a/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp b/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp index 2296dc8fabf..581740d75b0 100644 --- a/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp +++ b/yql/essentials/minikql/perf/block_groupby/block_groupby.cpp @@ -110,7 +110,7 @@ private: }; public: - TAggregate(const std::vector<IAggregator*>& aggs) + explicit TAggregate(const std::vector<IAggregator*>& aggs) : Aggs_(aggs) , Rh_(sizeof(i64)) { diff --git a/yql/essentials/minikql/protobuf_udf/ut/type_builder_ut.cpp b/yql/essentials/minikql/protobuf_udf/ut/type_builder_ut.cpp index 3faf038a03c..c84a019da62 100644 --- a/yql/essentials/minikql/protobuf_udf/ut/type_builder_ut.cpp +++ b/yql/essentials/minikql/protobuf_udf/ut/type_builder_ut.cpp @@ -31,7 +31,7 @@ struct TSetup { , Env(Alloc) , FunctionRegistry(CreateFunctionRegistry(IBuiltinFunctionRegistry::TPtr())) , TypeInfoHelper(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder(UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, {}) + , FunctionTypeInfoBuilder(UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, NYql::NUdf::TSourcePosition()) , PgmBuilder(Env, *FunctionRegistry) { } diff --git a/yql/essentials/minikql/protobuf_udf/ut/value_builder_ut.cpp b/yql/essentials/minikql/protobuf_udf/ut/value_builder_ut.cpp index b9370562e29..2208ea46186 100644 --- a/yql/essentials/minikql/protobuf_udf/ut/value_builder_ut.cpp +++ b/yql/essentials/minikql/protobuf_udf/ut/value_builder_ut.cpp @@ -36,7 +36,7 @@ struct TSetup { , Env(Alloc) , FunctionRegistry(CreateFunctionRegistry(IBuiltinFunctionRegistry::TPtr())) , TypeInfoHelper(new TTypeInfoHelper()) - , FunctionTypeInfoBuilder(UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, {}) + , FunctionTypeInfoBuilder(UnknownLangVersion, Env, TypeInfoHelper, "", nullptr, NYql::NUdf::TSourcePosition()) , PgmBuilder(Env, *FunctionRegistry) , MemInfo("Test") , HolderFactory(Alloc.Ref(), MemInfo) diff --git a/yql/essentials/minikql/protobuf_udf/value_builder.h b/yql/essentials/minikql/protobuf_udf/value_builder.h index 8325bd5809b..62b73677f14 100644 --- a/yql/essentials/minikql/protobuf_udf/value_builder.h +++ b/yql/essentials/minikql/protobuf_udf/value_builder.h @@ -11,7 +11,7 @@ namespace NUdf { class TProtobufValue: public TBoxedValue { public: - TProtobufValue(const TProtoInfo& info); + explicit TProtobufValue(const TProtoInfo& info); ~TProtobufValue() override; TUnboxedValue Run( @@ -26,7 +26,7 @@ protected: class TProtobufSerialize: public TBoxedValue { public: - TProtobufSerialize(const TProtoInfo& info); + explicit TProtobufSerialize(const TProtoInfo& info); ~TProtobufSerialize() override; TUnboxedValue Run( diff --git a/yql/essentials/parser/common/antlr4/lexer_tokens_collector.h b/yql/essentials/parser/common/antlr4/lexer_tokens_collector.h index ac3f0702c1b..bc1cd655176 100644 --- a/yql/essentials/parser/common/antlr4/lexer_tokens_collector.h +++ b/yql/essentials/parser/common/antlr4/lexer_tokens_collector.h @@ -12,7 +12,7 @@ namespace NAST { template <typename TLexer> class TLexerTokensCollector4 { public: - TLexerTokensCollector4(TStringBuf data, const TString& queryName = "query") + explicit TLexerTokensCollector4(TStringBuf data, const TString& queryName = "query") : QueryName(queryName) , InputStream(data) , Lexer(&InputStream) diff --git a/yql/essentials/parser/lexer_common/lexer.cpp b/yql/essentials/parser/lexer_common/lexer.cpp index 7c7dd5bda13..c84f1ac1c87 100644 --- a/yql/essentials/parser/lexer_common/lexer.cpp +++ b/yql/essentials/parser/lexer_common/lexer.cpp @@ -9,7 +9,7 @@ namespace { class TDummyLexer: public ILexer { public: - TDummyLexer(const TString& name) + explicit TDummyLexer(const TString& name) : Name_(name) { } @@ -29,7 +29,7 @@ private: class TDummyFactory: public ILexerFactory { public: - TDummyFactory(const TString& name) + explicit TDummyFactory(const TString& name) : Name_(name) { } diff --git a/yql/essentials/parser/pg_catalog/catalog.cpp b/yql/essentials/parser/pg_catalog/catalog.cpp index ebdc09126af..8d23fd58311 100644 --- a/yql/essentials/parser/pg_catalog/catalog.cpp +++ b/yql/essentials/parser/pg_catalog/catalog.cpp @@ -1068,7 +1068,7 @@ private: class TOpFamiliesParser: public TParser { public: - TOpFamiliesParser(TOpFamilies& opFamilies) + explicit TOpFamiliesParser(TOpFamilies& opFamilies) : OpFamilies_(opFamilies) { } @@ -1263,7 +1263,7 @@ private: class TAmsParser: public TParser { public: - TAmsParser(TAms& ams) + explicit TAmsParser(TAms& ams) : Ams_(ams) { } @@ -1415,7 +1415,7 @@ private: class TLanguagesParser: public TParser { public: - TLanguagesParser(TLanguages& languages) + explicit TLanguagesParser(TLanguages& languages) : Languages_(languages) { } diff --git a/yql/essentials/parser/proto_ast/antlr3/proto_ast_antlr3.h b/yql/essentials/parser/proto_ast/antlr3/proto_ast_antlr3.h index a36e2cfda22..20133318f8a 100644 --- a/yql/essentials/parser/proto_ast/antlr3/proto_ast_antlr3.h +++ b/yql/essentials/parser/proto_ast/antlr3/proto_ast_antlr3.h @@ -12,7 +12,7 @@ class TProtoASTBuilder3 { typedef ANTLR_UINT8 TChar; public: - TProtoASTBuilder3(TStringBuf data, const TString& queryName = "query", google::protobuf::Arena* arena = nullptr) + explicit TProtoASTBuilder3(TStringBuf data, const TString& queryName = "query", google::protobuf::Arena* arena = nullptr) : QueryName_(queryName) , InputStream_((const TChar*)data.data(), antlr3::ENC_8BIT, data.length(), (TChar*)QueryName_.begin()) // Why the hell antlr needs non-const ptr?? , Lexer_(&InputStream_, static_cast<google::protobuf::Arena*>(nullptr)) diff --git a/yql/essentials/parser/proto_ast/antlr4/proto_ast_antlr4.h b/yql/essentials/parser/proto_ast/antlr4/proto_ast_antlr4.h index e126a150bbc..4695e39987c 100644 --- a/yql/essentials/parser/proto_ast/antlr4/proto_ast_antlr4.h +++ b/yql/essentials/parser/proto_ast/antlr4/proto_ast_antlr4.h @@ -34,7 +34,7 @@ inline void InvalidToken<antlr4::Token>(IOutputStream& err, const antlr4::Token* template <typename TParser, typename TLexer> class TProtoASTBuilder4 { public: - TProtoASTBuilder4( + explicit TProtoASTBuilder4( TStringBuf data, const TString& queryName = "query", google::protobuf::Arena* arena = nullptr, diff --git a/yql/essentials/providers/common/arrow_resolve/yql_simple_arrow_resolver.cpp b/yql/essentials/providers/common/arrow_resolve/yql_simple_arrow_resolver.cpp index 6458730aeb0..73dfeb6334b 100644 --- a/yql/essentials/providers/common/arrow_resolve/yql_simple_arrow_resolver.cpp +++ b/yql/essentials/providers/common/arrow_resolve/yql_simple_arrow_resolver.cpp @@ -14,7 +14,7 @@ using namespace NKikimr::NMiniKQL; class TSimpleArrowResolver: public IArrowResolver { public: - TSimpleArrowResolver(const IFunctionRegistry& functionRegistry) + explicit TSimpleArrowResolver(const IFunctionRegistry& functionRegistry) : FunctionRegistry_(functionRegistry) { } diff --git a/yql/essentials/providers/common/codec/yql_codec.cpp b/yql/essentials/providers/common/codec/yql_codec.cpp index 549949f5284..0dd0367fd19 100644 --- a/yql/essentials/providers/common/codec/yql_codec.cpp +++ b/yql/essentials/providers/common/codec/yql_codec.cpp @@ -1245,7 +1245,7 @@ TMaybe<NUdf::TUnboxedValue> ParseYsonValue(const THolderFactory& holderFactory, try { class TReader: public IBlockReader { public: - TReader(const TStringBuf& yson) + explicit TReader(const TStringBuf& yson) : Yson_(yson) { } diff --git a/yql/essentials/providers/common/codec/yql_codec_buf.h b/yql/essentials/providers/common/codec/yql_codec_buf.h index c876b9947f1..1ab436815d4 100644 --- a/yql/essentials/providers/common/codec/yql_codec_buf.h +++ b/yql/essentials/providers/common/codec/yql_codec_buf.h @@ -58,7 +58,7 @@ class TInputBuf { friend void InputBufSkipManySlowThunk(TInputBuf& in, size_t count); public: - TInputBuf(NKikimr::NMiniKQL::TSamplingStatTimer* readTimer) + explicit TInputBuf(NKikimr::NMiniKQL::TSamplingStatTimer* readTimer) : ReadTimer_(readTimer) { } diff --git a/yql/essentials/providers/common/config/yql_dispatch.h b/yql/essentials/providers/common/config/yql_dispatch.h index a22137a4d8b..e63fd3609d8 100644 --- a/yql/essentials/providers/common/config/yql_dispatch.h +++ b/yql/essentials/providers/common/config/yql_dispatch.h @@ -110,7 +110,7 @@ public: public: using TPtr = TIntrusivePtr<TSettingHandler>; - TSettingHandler(const TString& name) + explicit TSettingHandler(const TString& name) : Name_(name) { } @@ -346,7 +346,7 @@ public: bool IgnoreInFullReplay_ = false; }; - TSettingDispatcher(const TQContext& qContext = {}) + explicit TSettingDispatcher(const TQContext& qContext = {}) : QContext_(qContext) { } @@ -354,7 +354,7 @@ public: TSettingDispatcher(const TSettingDispatcher&) = delete; template <class TContainer> - TSettingDispatcher(const TContainer& validClusters) + explicit TSettingDispatcher(const TContainer& validClusters) : ValidClusters(validClusters.begin(), validClusters.end()) { } diff --git a/yql/essentials/providers/common/config/yql_setting.h b/yql/essentials/providers/common/config/yql_setting.h index cbc0133571b..1ee4bf85ab4 100644 --- a/yql/essentials/providers/common/config/yql_setting.h +++ b/yql/essentials/providers/common/config/yql_setting.h @@ -22,7 +22,7 @@ template <typename TType, EConfSettingType SettingType = EConfSettingType::Dynam class TConfSetting { public: TConfSetting() = default; - TConfSetting(const TType& value) { + explicit TConfSetting(const TType& value) { PerClusterValue_[ALL_CLUSTERS] = value; } TConfSetting(const TConfSetting&) = default; @@ -93,7 +93,7 @@ template <typename TType> class TConfSetting<TType, EConfSettingType::Static> { public: TConfSetting() = default; - TConfSetting(const TType& value) + explicit TConfSetting(const TType& value) : Value_(value) { } diff --git a/yql/essentials/providers/common/metrics/service_counters.h b/yql/essentials/providers/common/metrics/service_counters.h index 1b4a5214ca4..e309c9cb22f 100644 --- a/yql/essentials/providers/common/metrics/service_counters.h +++ b/yql/essentials/providers/common/metrics/service_counters.h @@ -23,7 +23,7 @@ struct TServiceCounters { const ::NMonitoring::TDynamicCounterPtr& baseCounters, const TString& subsystemName = ""); - explicit TServiceCounters( + TServiceCounters( const TServiceCounters& serviceCounters, const TString& subsystemName = ""); diff --git a/yql/essentials/providers/common/provider/yql_provider.h b/yql/essentials/providers/common/provider/yql_provider.h index f7c435cdad1..785d00e5d79 100644 --- a/yql/essentials/providers/common/provider/yql_provider.h +++ b/yql/essentials/providers/common/provider/yql_provider.h @@ -55,7 +55,7 @@ struct TWriteTableSettings { NNodes::TMaybeNode<NNodes::TCoAtom> TableType; NNodes::TMaybeNode<NNodes::TCallable> PgFilter; - TWriteTableSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteTableSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -69,7 +69,7 @@ struct TWriteSequenceSettings { NNodes::TCoNameValueTupleList Other; - TWriteSequenceSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteSequenceSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -84,7 +84,7 @@ struct TWriteTopicSettings { NNodes::TMaybeNode<NNodes::TCoAtomList> DropConsumers; NNodes::TCoNameValueTupleList Other; - TWriteTopicSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteTopicSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -96,7 +96,7 @@ struct TWriteReplicationSettings { NNodes::TMaybeNode<NNodes::TCoNameValueTupleList> ReplicationSettings; NNodes::TCoNameValueTupleList Other; - TWriteReplicationSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteReplicationSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -110,7 +110,7 @@ struct TWriteTransferSettings { NNodes::TMaybeNode<NNodes::TCoNameValueTupleList> TransferSettings; NNodes::TCoNameValueTupleList Other; - TWriteTransferSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteTransferSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -120,7 +120,7 @@ struct TDatabaseSettings { NNodes::TMaybeNode<NNodes::TCoAtom> Mode; NNodes::TCoNameValueTupleList Other; - TDatabaseSettings(const NNodes::TCoNameValueTupleList& other) + explicit TDatabaseSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -132,7 +132,7 @@ struct TWriteRoleSettings { NNodes::TMaybeNode<NNodes::TCoAtom> NewName; NNodes::TCoNameValueTupleList Other; - TWriteRoleSettings(const NNodes::TCoNameValueTupleList& other) + explicit TWriteRoleSettings(const NNodes::TCoNameValueTupleList& other) : Other(other) { } @@ -169,7 +169,7 @@ struct TCommitSettings { NNodes::TMaybeNode<NNodes::TCoAtom> Epoch; NNodes::TCoNameValueTupleList Other; - TCommitSettings(NNodes::TCoNameValueTupleList other) + explicit TCommitSettings(NNodes::TCoNameValueTupleList other) : Other(other) { } diff --git a/yql/essentials/providers/common/schema/expr/yql_expr_schema.cpp b/yql/essentials/providers/common/schema/expr/yql_expr_schema.cpp index 62ee54b2d13..7cb6ff8a5ce 100644 --- a/yql/essentials/providers/common/schema/expr/yql_expr_schema.cpp +++ b/yql/essentials/providers/common/schema/expr/yql_expr_schema.cpp @@ -24,7 +24,7 @@ class TExprTypeSaver: public TSaver<TExprTypeSaver<TSaver>> { struct TStructAdaptor { const TStructExprType* Type; - TStructAdaptor(const TStructExprType* type) + explicit TStructAdaptor(const TStructExprType* type) : Type(type) { } @@ -84,7 +84,7 @@ class TExprTypeSaver: public TSaver<TExprTypeSaver<TSaver>> { struct TTupleAdaptor { const TTupleExprType* Type; - TTupleAdaptor(const TTupleExprType* type) + explicit TTupleAdaptor(const TTupleExprType* type) : Type(type) { } @@ -101,7 +101,7 @@ class TExprTypeSaver: public TSaver<TExprTypeSaver<TSaver>> { struct TCallableAdaptor { const TCallableExprType* Type; - TCallableAdaptor(const TCallableExprType* type) + explicit TCallableAdaptor(const TCallableExprType* type) : Type(type) { } @@ -290,7 +290,7 @@ struct TExprTypeLoader { TExprContext& Ctx; TPosition Pos; - TExprTypeLoader(TExprContext& ctx, const TPosition& pos = TPosition()) + explicit TExprTypeLoader(TExprContext& ctx, const TPosition& pos = TPosition()) : Ctx(ctx) , Pos(pos) { diff --git a/yql/essentials/providers/common/schema/mkql/yql_mkql_schema.cpp b/yql/essentials/providers/common/schema/mkql/yql_mkql_schema.cpp index 0c0f61110c6..ff34e61d2b2 100644 --- a/yql/essentials/providers/common/schema/mkql/yql_mkql_schema.cpp +++ b/yql/essentials/providers/common/schema/mkql/yql_mkql_schema.cpp @@ -30,7 +30,7 @@ class TRuntimeTypeSaver: public TSaver<TRuntimeTypeSaver<TSaver>> { NKikimr::NMiniKQL::TTypeInfoHelper TypeHelper; NKikimr::NUdf::TCallableTypeInspector CallableInspector; - TCallableAdaptor(const NKikimr::NMiniKQL::TCallableType* type) + explicit TCallableAdaptor(const NKikimr::NMiniKQL::TCallableType* type) : Type(type) , TypeHelper() , CallableInspector(TypeHelper, Type) @@ -67,7 +67,7 @@ class TRuntimeTypeSaver: public TSaver<TRuntimeTypeSaver<TSaver>> { }; public: - TRuntimeTypeSaver(typename TBase::TConsumer& consumer) + explicit TRuntimeTypeSaver(typename TBase::TConsumer& consumer) : TBase(consumer, false) { } diff --git a/yql/essentials/providers/common/schema/skiff/yql_skiff_schema.cpp b/yql/essentials/providers/common/schema/skiff/yql_skiff_schema.cpp index 9986d82fdff..ecd2206679b 100644 --- a/yql/essentials/providers/common/schema/skiff/yql_skiff_schema.cpp +++ b/yql/essentials/providers/common/schema/skiff/yql_skiff_schema.cpp @@ -14,7 +14,7 @@ namespace NCommon { struct TSkiffTypeLoader { typedef NYT::TNode TType; - TSkiffTypeLoader(ui64 nativeYTTypesFlags) + explicit TSkiffTypeLoader(ui64 nativeYTTypesFlags) : NativeYTTypesFlags(nativeYTTypesFlags) { } diff --git a/yql/essentials/providers/common/transform/yql_lazy_init.h b/yql/essentials/providers/common/transform/yql_lazy_init.h index ad0fae103da..537fe6c8e80 100644 --- a/yql/essentials/providers/common/transform/yql_lazy_init.h +++ b/yql/essentials/providers/common/transform/yql_lazy_init.h @@ -13,7 +13,7 @@ class TLazyInitHolder public: using TFactory = std::function<THolder<T>()>; - TLazyInitHolder(TFactory&& factory) + explicit TLazyInitHolder(TFactory&& factory) : Factory_(std::move(factory)) { } diff --git a/yql/essentials/providers/common/transform/yql_optimize.cpp b/yql/essentials/providers/common/transform/yql_optimize.cpp index e0d549392a3..d238a18fece 100644 --- a/yql/essentials/providers/common/transform/yql_optimize.cpp +++ b/yql/essentials/providers/common/transform/yql_optimize.cpp @@ -12,7 +12,7 @@ using namespace NNodes; class TOptimizeTransformerBase::TIgnoreOptimizationContext: public IOptimizationContext { public: - TIgnoreOptimizationContext(TOptimizeTransformerBase::TGetParents getParents) + explicit TIgnoreOptimizationContext(TOptimizeTransformerBase::TGetParents getParents) : GetParents_(std::move(getParents)) { } @@ -30,7 +30,7 @@ private: class TOptimizeTransformerBase::TRemapOptimizationContext: public IOptimizationContext { public: - TRemapOptimizationContext(TNodeOnNodeOwnedMap& remaps) + explicit TRemapOptimizationContext(TNodeOnNodeOwnedMap& remaps) : Remaps_(remaps) { } diff --git a/yql/essentials/providers/common/transform/yql_visit.h b/yql/essentials/providers/common/transform/yql_visit.h index bb74341968f..e80754176a1 100644 --- a/yql/essentials/providers/common/transform/yql_visit.h +++ b/yql/essentials/providers/common/transform/yql_visit.h @@ -16,7 +16,7 @@ class TVisitorTransformerBase: public TSyncTransformerBase { public: using THandler = std::function<TStatus(const TExprNode::TPtr&, TExprNode::TPtr&, TExprContext&)>; - TVisitorTransformerBase(bool failOnUnknown) + explicit TVisitorTransformerBase(bool failOnUnknown) : FailOnUnknown_(failOnUnknown) { } diff --git a/yql/essentials/providers/common/udf_resolve/yql_simple_udf_resolver.cpp b/yql/essentials/providers/common/udf_resolve/yql_simple_udf_resolver.cpp index 3b6c37e5dca..f49cb461312 100644 --- a/yql/essentials/providers/common/udf_resolve/yql_simple_udf_resolver.cpp +++ b/yql/essentials/providers/common/udf_resolve/yql_simple_udf_resolver.cpp @@ -186,7 +186,7 @@ bool LoadFunctionsMetadata(const TVector<IUdfResolver::TFunction*>& functions, } TStringStream err; - mkqlUserType = BuildType(*udf.UserType, {env}, err); // + mkqlUserType = BuildType(*udf.UserType, TTypeBuilder(env), err); if (!mkqlUserType) { auto issue = TIssue(udf.Pos, TStringBuilder() << "Invalid user type for function: " << udf.Name << ", error: " << err.Str()); @@ -207,7 +207,7 @@ bool LoadFunctionsMetadata(const TVector<IUdfResolver::TFunction*>& functions, TFunctionTypeInfo funcInfo; auto status = functionRegistry.FindFunctionTypeInfo(udf.LangVer, env, typeInfoHelper, nullptr, - udf.Name, mkqlUserType, udf.TypeConfig, NUdf::IUdfModule::TFlags::TypesOnly, {}, secureParamsProvider.get(), + udf.Name, mkqlUserType, udf.TypeConfig, NUdf::IUdfModule::TFlags::TypesOnly, NUdf::TSourcePosition(), secureParamsProvider.get(), logProvider.Get(), &funcInfo); if (!status.IsOk()) { ctx.AddError(TIssue(udf.Pos, TStringBuilder() << "Failed to find UDF function: " << udf.Name diff --git a/yql/essentials/providers/config/yql_config_provider.cpp b/yql/essentials/providers/config/yql_config_provider.cpp index 1757a47d5d3..4f8bd4ca4ef 100644 --- a/yql/essentials/providers/config/yql_config_provider.cpp +++ b/yql/essentials/providers/config/yql_config_provider.cpp @@ -35,7 +35,7 @@ using namespace NNodes; class TConfigCallableExecutionTransformer: public TSyncTransformerBase { public: - TConfigCallableExecutionTransformer(const TTypeAnnotationContext& types) + explicit TConfigCallableExecutionTransformer(const TTypeAnnotationContext& types) : Types_(types) { Y_UNUSED(Types_); diff --git a/yql/essentials/providers/pg/provider/yql_pg_datasink.cpp b/yql/essentials/providers/pg/provider/yql_pg_datasink.cpp index d86ca259471..fbf9e24e696 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_datasink.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_datasink.cpp @@ -11,7 +11,7 @@ using namespace NNodes; class TPgDataSinkImpl: public TDataProviderBase { public: - TPgDataSinkImpl(TPgState::TPtr state) + explicit TPgDataSinkImpl(TPgState::TPtr state) : State_(state) , TypeAnnotationTransformer_(CreatePgDataSinkTypeAnnotationTransformer(state)) , ExecutionTransformer_(CreatePgDataSinkExecTransformer(state)) diff --git a/yql/essentials/providers/pg/provider/yql_pg_datasink_execution.cpp b/yql/essentials/providers/pg/provider/yql_pg_datasink_execution.cpp index 35df7aefc2a..3af6dbd0a9e 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_datasink_execution.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_datasink_execution.cpp @@ -15,7 +15,7 @@ using namespace NNodes; class TPgDataSinkExecTransformer: public TExecTransformerBase { public: - TPgDataSinkExecTransformer(TPgState::TPtr state) + explicit TPgDataSinkExecTransformer(TPgState::TPtr state) : State_(state) { AddHandler({TCoCommit::CallableName()}, RequireFirst(), Pass()); diff --git a/yql/essentials/providers/pg/provider/yql_pg_datasink_type_ann.cpp b/yql/essentials/providers/pg/provider/yql_pg_datasink_type_ann.cpp index 597e976bf14..44d822aac81 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_datasink_type_ann.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_datasink_type_ann.cpp @@ -15,7 +15,7 @@ using namespace NNodes; class TPgDataSinkTypeAnnotationTransformer: public TVisitorTransformerBase { public: - TPgDataSinkTypeAnnotationTransformer(TPgState::TPtr state) + explicit TPgDataSinkTypeAnnotationTransformer(TPgState::TPtr state) : TVisitorTransformerBase(true) , State_(state) { diff --git a/yql/essentials/providers/pg/provider/yql_pg_datasource.cpp b/yql/essentials/providers/pg/provider/yql_pg_datasource.cpp index e35ec3b4948..bf1db36ee98 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_datasource.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_datasource.cpp @@ -14,7 +14,7 @@ using namespace NNodes; class TPgDataSourceImpl: public TDataProviderBase { public: - TPgDataSourceImpl(TPgState::TPtr state) + explicit TPgDataSourceImpl(TPgState::TPtr state) : State_(state) , TypeAnnotationTransformer_(CreatePgDataSourceTypeAnnotationTransformer(state)) , DqIntegration_(CreatePgDqIntegration(State_)) diff --git a/yql/essentials/providers/pg/provider/yql_pg_datasource_type_ann.cpp b/yql/essentials/providers/pg/provider/yql_pg_datasource_type_ann.cpp index 72eef05d5be..220b7f5f7ab 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_datasource_type_ann.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_datasource_type_ann.cpp @@ -12,7 +12,7 @@ using namespace NNodes; class TPgDataSourceTypeAnnotationTransformer: public TVisitorTransformerBase { public: - TPgDataSourceTypeAnnotationTransformer(TPgState::TPtr state) + explicit TPgDataSourceTypeAnnotationTransformer(TPgState::TPtr state) : TVisitorTransformerBase(true) , State_(state) { diff --git a/yql/essentials/providers/pg/provider/yql_pg_dq_integration.cpp b/yql/essentials/providers/pg/provider/yql_pg_dq_integration.cpp index febc6a41922..294a12eb138 100644 --- a/yql/essentials/providers/pg/provider/yql_pg_dq_integration.cpp +++ b/yql/essentials/providers/pg/provider/yql_pg_dq_integration.cpp @@ -10,7 +10,7 @@ namespace { class TPgDqIntegration: public TDqIntegrationBase { public: - TPgDqIntegration(TPgState::TPtr state) + explicit TPgDqIntegration(TPgState::TPtr state) : State_(state) { } diff --git a/yql/essentials/providers/pure/yql_pure_provider.cpp b/yql/essentials/providers/pure/yql_pure_provider.cpp index 60b609e6ef3..2a1a5c78260 100644 --- a/yql/essentials/providers/pure/yql_pure_provider.cpp +++ b/yql/essentials/providers/pure/yql_pure_provider.cpp @@ -34,7 +34,7 @@ using namespace NKikimr::NMiniKQL; class TPureDataSinkExecTransformer: public TExecTransformerBase { public: - TPureDataSinkExecTransformer(const TPureState::TPtr state) + explicit TPureDataSinkExecTransformer(const TPureState::TPtr state) : State_(state) { AddHandler({TStringBuf("Result")}, RequireNone(), Hndl(&TPureDataSinkExecTransformer::HandleRes)); @@ -228,7 +228,7 @@ THolder<TExecTransformerBase> CreatePureDataSourceExecTransformer(const TPureSta class TPureProvider: public TDataProviderBase { public: - TPureProvider(const TPureState::TPtr& state) + explicit TPureProvider(const TPureState::TPtr& state) : State_(state) , ExecTransformer_([this]() { return CreatePureDataSourceExecTransformer(State_); }) { diff --git a/yql/essentials/providers/result/provider/yql_result_provider.cpp b/yql/essentials/providers/result/provider/yql_result_provider.cpp index fa227efbaf4..efd740e65c1 100644 --- a/yql/essentials/providers/result/provider/yql_result_provider.cpp +++ b/yql/essentials/providers/result/provider/yql_result_provider.cpp @@ -27,7 +27,7 @@ using namespace NNodes; class TYsonResultWriter: public IResultWriter { public: - TYsonResultWriter(NYson::EYsonFormat format) + explicit TYsonResultWriter(NYson::EYsonFormat format) : Writer_(new NYson::TYsonWriter(&PartialStream_, format, ::NYson::EYsonType::Node, true)) { } @@ -228,7 +228,7 @@ IGraphTransformer::TStatus ValidateColumns(TExprNode::TPtr& columns, const TType class TResultCallableExecutionTransformer: public TGraphTransformerBase { public: - TResultCallableExecutionTransformer(const TIntrusivePtr<TResultProviderConfig>& config) + explicit TResultCallableExecutionTransformer(const TIntrusivePtr<TResultProviderConfig>& config) : Config_(config) { YQL_ENSURE(!Config_->Types.AvailablePureResultDataSources.empty()); @@ -678,7 +678,7 @@ bool& TResultCallableExecutionTransformer::GetOverflowFlagAndCommitedSize<TPull> class TResultTrackableNodeProcessor: public TTrackableNodeProcessorBase { public: - TResultTrackableNodeProcessor(const TIntrusivePtr<TResultProviderConfig>& config) + explicit TResultTrackableNodeProcessor(const TIntrusivePtr<TResultProviderConfig>& config) : Config_(config) { } @@ -698,7 +698,7 @@ private: class TPhysicalFinalizingTransformer final: public TSyncTransformerBase { public: - TPhysicalFinalizingTransformer(const TIntrusivePtr<TResultProviderConfig>& config) + explicit TPhysicalFinalizingTransformer(const TIntrusivePtr<TResultProviderConfig>& config) : Config_(config) { } @@ -945,7 +945,7 @@ public: } }; - TResultProvider(const TIntrusivePtr<TResultProviderConfig>& config) + explicit TResultProvider(const TIntrusivePtr<TResultProviderConfig>& config) : Config_(config) , TrackableNodeProcessor_(config) { diff --git a/yql/essentials/public/decimal/yql_decimal.h b/yql/essentials/public/decimal/yql_decimal.h index 1967b4c120f..23758ab2ffb 100644 --- a/yql/essentials/public/decimal/yql_decimal.h +++ b/yql/essentials/public/decimal/yql_decimal.h @@ -174,7 +174,7 @@ struct TDecimal { TDecimal() = default; template <typename T> - TDecimal(T t) + TDecimal(T t) // NOLINT(google-explicit-constructor) : Value(t) { } @@ -231,7 +231,7 @@ protected: const TInt128 Bound_; public: - TDecimalMultiplicator( + explicit TDecimalMultiplicator( ui8 precision, ui8 scale = 0 /* unused */) : Bound_(GetDivider(precision)) @@ -279,7 +279,7 @@ public: template <typename TRight> class TDecimalDivisor { public: - TDecimalDivisor( + explicit TDecimalDivisor( ui8 precision = 0 /* unused */, ui8 scale = 0 /* unused */) { @@ -350,7 +350,7 @@ public: template <> class TDecimalRemainder<TInt128> { public: - TDecimalRemainder( + explicit TDecimalRemainder( ui8 precision = 0 /*unused*/, ui8 scale = 0 /*unused*/) { diff --git a/yql/essentials/public/decimal/yql_wide_int.h b/yql/essentials/public/decimal/yql_wide_int.h index 87922724284..4c340b12e2a 100644 --- a/yql/essentials/public/decimal/yql_wide_int.h +++ b/yql/essentials/public/decimal/yql_wide_int.h @@ -78,6 +78,8 @@ public: constexpr TWide& operator=(const TWide& rhs) = default; constexpr TWide& operator=(TWide&& rhs) = default; + // Implicit casts between numbers is not surprising + // NOLINTNEXTLINE(google-explicit-constructor) constexpr TWide(const TSibling& rhs) : Lo_(rhs.Lo_) , Hi_(rhs.Hi_) @@ -92,21 +94,21 @@ public: } template <typename T, std::enable_if_t<std::is_integral<T>::value && sizeof(THalf) < sizeof(T), size_t> Shift = PartBitSize> - constexpr TWide(const T rhs) + constexpr TWide(const T rhs) // NOLINT(google-explicit-constructor) : Lo_(rhs) , Hi_(rhs >> Shift) { } template <typename T, std::enable_if_t<std::is_integral<T>::value && sizeof(T) <= sizeof(THalf), bool> Signed = std::is_signed<T>::value> - constexpr TWide(const T rhs) + constexpr TWide(const T rhs) // NOLINT(google-explicit-constructor) : Lo_(rhs) , Hi_(Signed && rhs < 0 ? ~0 : 0) { } template <typename T, typename TArg = std::enable_if_t<std::is_class<T>::value && std::is_same<T, THalf>::value, THalf>> - constexpr explicit TWide(const T& rhs) + constexpr TWide(const T& rhs) // NOLINT(google-explicit-constructor) : Lo_(rhs) , Hi_(TIsSigned::value && rhs < 0 ? ~0 : 0) { diff --git a/yql/essentials/public/fastcheck/parser.cpp b/yql/essentials/public/fastcheck/parser.cpp index e122beb1291..b827aa6ff11 100644 --- a/yql/essentials/public/fastcheck/parser.cpp +++ b/yql/essentials/public/fastcheck/parser.cpp @@ -42,7 +42,7 @@ private: class TPGParseEventsHandler: public IPGParseEvents { public: - TPGParseEventsHandler(TCheckResponse& res) + explicit TPGParseEventsHandler(TCheckResponse& res) : Res_(res) { } diff --git a/yql/essentials/public/issue/yql_issue.h b/yql/essentials/public/issue/yql_issue.h index ea13026779b..37056ee0552 100644 --- a/yql/essentials/public/issue/yql_issue.h +++ b/yql/essentials/public/issue/yql_issue.h @@ -82,7 +82,7 @@ struct TRange { TRange() = default; - TRange(TPosition position) + explicit TRange(TPosition position) : Position(position) , EndPosition(position) { @@ -226,6 +226,8 @@ class TIssues { public: TIssues() = default; + // TODO(YQL-20095): there are YDB usages + // NOLINTNEXTLINE(google-explicit-constructor) inline TIssues(const TVector<TIssue>& issues) : Issues_(issues) { diff --git a/yql/essentials/public/issue/yql_warning.h b/yql/essentials/public/issue/yql_warning.h index 16cf21dc82c..40b99eaa12e 100644 --- a/yql/essentials/public/issue/yql_warning.h +++ b/yql/essentials/public/issue/yql_warning.h @@ -41,7 +41,7 @@ using TWarningRules = TVector<TWarningRule>; class TWarningPolicy { public: - TWarningPolicy(bool isReplay = false); + explicit TWarningPolicy(bool isReplay = false); void AddRule(const TWarningRule& rule); diff --git a/yql/essentials/public/purecalc/common/transformations/type_annotation.cpp b/yql/essentials/public/purecalc/common/transformations/type_annotation.cpp index 61f14fcc65a..1a909ff9574 100644 --- a/yql/essentials/public/purecalc/common/transformations/type_annotation.cpp +++ b/yql/essentials/public/purecalc/common/transformations/type_annotation.cpp @@ -18,7 +18,7 @@ class TTypeAnnotatorBase: public TSyncTransformerBase { public: using THandler = std::function<TStatus(const TExprNode::TPtr&, TExprNode::TPtr&, TExprContext&)>; - TTypeAnnotatorBase(TTypeAnnotationContextPtr typeAnnotationContext) + explicit TTypeAnnotatorBase(TTypeAnnotationContextPtr typeAnnotationContext) { OriginalTransformer_.reset(CreateExtCallableTypeAnnotationTransformer(*typeAnnotationContext).Release()); } diff --git a/yql/essentials/public/purecalc/io_specs/arrow/spec.cpp b/yql/essentials/public/purecalc/io_specs/arrow/spec.cpp index 681c0a007f3..558b6a14c2a 100644 --- a/yql/essentials/public/purecalc/io_specs/arrow/spec.cpp +++ b/yql/essentials/public/purecalc/io_specs/arrow/spec.cpp @@ -42,13 +42,13 @@ private: } public: - TArrowIStreamImpl(THolder<IArrowIStream> stream) + explicit TArrowIStreamImpl(THolder<IArrowIStream> stream) : TArrowIStreamImpl(stream.Get(), nullptr) { Owned_ = std::move(stream); } - TArrowIStreamImpl(IArrowIStream* stream) + explicit TArrowIStreamImpl(IArrowIStream* stream) : TArrowIStreamImpl(stream, nullptr) { } diff --git a/yql/essentials/public/purecalc/io_specs/arrow/ut/test_spec.cpp b/yql/essentials/public/purecalc/io_specs/arrow/ut/test_spec.cpp index 124fa65eef3..139200575d9 100644 --- a/yql/essentials/public/purecalc/io_specs/arrow/ut/test_spec.cpp +++ b/yql/essentials/public/purecalc/io_specs/arrow/ut/test_spec.cpp @@ -45,7 +45,7 @@ struct TVectorStream: public NYql::NPureCalc::IStream<T*> { size_t Index = 0; public: - TVectorStream(TVector<T> items) + explicit TVectorStream(TVector<T> items) : Data(std::move(items)) { } @@ -152,7 +152,7 @@ TVector<std::tuple<ui64, i64>> CanonLiteralBatches(const TVector<arrow::compute: using TExecBatchStreamImpl = TVectorStream<arrow::compute::ExecBatch>; struct TExecBatchConsumerImpl: public TVectorConsumer<arrow::compute::ExecBatch, std::tuple<ui64, i64>> { public: - TExecBatchConsumerImpl(TVector<std::tuple<ui64, i64>>& output) + explicit TExecBatchConsumerImpl(TVector<std::tuple<ui64, i64>>& output) : TVectorConsumer(output, &AddBatch) { } diff --git a/yql/essentials/public/purecalc/io_specs/protobuf/proto_variant.h b/yql/essentials/public/purecalc/io_specs/protobuf/proto_variant.h index 6f1703f01b6..e43bb0b3c56 100644 --- a/yql/essentials/public/purecalc/io_specs/protobuf/proto_variant.h +++ b/yql/essentials/public/purecalc/io_specs/protobuf/proto_variant.h @@ -42,7 +42,7 @@ protected: template <typename... T> class TProtobufsMappingStream: public IStream<TProtoMultiOutput<T...>>, public TProtobufsMappingBase<T...> { public: - TProtobufsMappingStream(THolder<IStream<TProtoRawMultiOutput>> oldStream) + explicit TProtobufsMappingStream(THolder<IStream<TProtoRawMultiOutput>> oldStream) : OldStream_(std::move(oldStream)) { } @@ -60,7 +60,7 @@ private: template <typename... T> class TProtobufsMappingConsumer: public IConsumer<TProtoRawMultiOutput>, public TProtobufsMappingBase<T...> { public: - TProtobufsMappingConsumer(THolder<IConsumer<TProtoMultiOutput<T...>>> oldConsumer) + explicit TProtobufsMappingConsumer(THolder<IConsumer<TProtoMultiOutput<T...>>> oldConsumer) : OldConsumer_(std::move(oldConsumer)) { } diff --git a/yql/essentials/public/purecalc/io_specs/protobuf/spec.h b/yql/essentials/public/purecalc/io_specs/protobuf/spec.h index f2e45fc8c74..21e66133352 100644 --- a/yql/essentials/public/purecalc/io_specs/protobuf/spec.h +++ b/yql/essentials/public/purecalc/io_specs/protobuf/spec.h @@ -17,7 +17,7 @@ class TProtobufInputSpec: public TProtobufRawInputSpec { "should be derived from google::protobuf::Message"); public: - TProtobufInputSpec( + explicit TProtobufInputSpec( const TMaybe<TString>& timestampColumn = Nothing(), const TProtoSchemaOptions& options = {}) : TProtobufRawInputSpec(*T::descriptor(), timestampColumn, options) @@ -36,7 +36,7 @@ class TProtobufOutputSpec: public TProtobufRawOutputSpec { "should be derived from google::protobuf::Message"); public: - TProtobufOutputSpec( + explicit TProtobufOutputSpec( const TProtoSchemaOptions& options = {}, google::protobuf::Arena* arena = nullptr) : TProtobufRawOutputSpec(*T::descriptor(), nullptr, options, arena) @@ -54,7 +54,7 @@ class TProtobufMultiOutputSpec: public TProtobufRawMultiOutputSpec { "all types should be derived from google::protobuf::Message"); public: - TProtobufMultiOutputSpec( + explicit TProtobufMultiOutputSpec( const TProtoSchemaOptions& options = {}, TMaybe<TVector<google::protobuf::Arena*>> arenas = {}) : TProtobufRawMultiOutputSpec({T::descriptor()...}, Nothing(), options, std::move(arenas)) diff --git a/yql/essentials/public/purecalc/io_specs/protobuf/ut/test_spec.cpp b/yql/essentials/public/purecalc/io_specs/protobuf/ut/test_spec.cpp index 981b8403754..1737a375989 100644 --- a/yql/essentials/public/purecalc/io_specs/protobuf/ut/test_spec.cpp +++ b/yql/essentials/public/purecalc/io_specs/protobuf/ut/test_spec.cpp @@ -90,7 +90,7 @@ public: class TSimpleMessageStreamImpl: public NYql::NPureCalc::IStream<NPureCalcProto::TSimpleMessage*> { public: - TSimpleMessageStreamImpl(i32 value) + explicit TSimpleMessageStreamImpl(i32 value) { Message_.SetX(value); } @@ -168,7 +168,7 @@ private: TVector<int>* Buf_; public: - TSimpleMessageConsumerImpl(TVector<int>* buf) + explicit TSimpleMessageConsumerImpl(TVector<int>* buf) : Buf_(buf) { } diff --git a/yql/essentials/public/purecalc/io_specs/protobuf_raw/spec.h b/yql/essentials/public/purecalc/io_specs/protobuf_raw/spec.h index a2ef2829a10..8dfd7814066 100644 --- a/yql/essentials/public/purecalc/io_specs/protobuf_raw/spec.h +++ b/yql/essentials/public/purecalc/io_specs/protobuf_raw/spec.h @@ -153,7 +153,7 @@ private: mutable NYT::TNode SavedSchema_; public: - TProtobufRawMultiOutputSpec( + explicit TProtobufRawMultiOutputSpec( TVector<const google::protobuf::Descriptor*>, TMaybe<TVector<google::protobuf::MessageFactory*>> = {}, const TProtoSchemaOptions& options = {}, diff --git a/yql/essentials/public/purecalc/ut/test_mixed_allocators.cpp b/yql/essentials/public/purecalc/ut/test_mixed_allocators.cpp index 3dad746a045..f23182a43c6 100644 --- a/yql/essentials/public/purecalc/ut/test_mixed_allocators.cpp +++ b/yql/essentials/public/purecalc/ut/test_mixed_allocators.cpp @@ -32,7 +32,7 @@ private: class TStatelessInputConsumer: public IConsumer<const NYql::NUdf::TUnboxedValue&> { public: - TStatelessInputConsumer(TWorkerHolder<IPushStreamWorker> worker) + explicit TStatelessInputConsumer(TWorkerHolder<IPushStreamWorker> worker) : Worker_(std::move(worker)) { } diff --git a/yql/essentials/public/purecalc/ut/test_pool.cpp b/yql/essentials/public/purecalc/ut/test_pool.cpp index 90ae69b8bc2..ee229dce336 100644 --- a/yql/essentials/public/purecalc/ut/test_pool.cpp +++ b/yql/essentials/public/purecalc/ut/test_pool.cpp @@ -32,7 +32,7 @@ private: TVector<TString>* Buf_; public: - TStringMessageConsumerImpl(TVector<TString>* buf) + explicit TStringMessageConsumerImpl(TVector<TString>* buf) : Buf_(buf) { } diff --git a/yql/essentials/public/result_format/yql_restricted_yson.cpp b/yql/essentials/public/result_format/yql_restricted_yson.cpp index 893fe812d24..c02bcc25e4c 100644 --- a/yql/essentials/public/result_format/yql_restricted_yson.cpp +++ b/yql/essentials/public/result_format/yql_restricted_yson.cpp @@ -18,7 +18,7 @@ namespace NResult { namespace { class TRestrictedYsonFormatter: public NYson::TYsonConsumerBase { public: - TRestrictedYsonFormatter(TYsonResultWriter& writer) + explicit TRestrictedYsonFormatter(TYsonResultWriter& writer) : Writer_(writer) { } diff --git a/yql/essentials/public/result_format/yql_result_format_data.cpp b/yql/essentials/public/result_format/yql_result_format_data.cpp index a1cefe7f484..cba64902e2f 100644 --- a/yql/essentials/public/result_format/yql_result_format_data.cpp +++ b/yql/essentials/public/result_format/yql_result_format_data.cpp @@ -110,7 +110,7 @@ public: class TOptionalProcessor: public IDataProcessor { public: - TOptionalProcessor(std::unique_ptr<IDataProcessor>&& inner) + explicit TOptionalProcessor(std::unique_ptr<IDataProcessor>&& inner) : Inner_(std::move(inner)) { } @@ -135,7 +135,7 @@ private: class TListProcessor: public IDataProcessor { public: - TListProcessor(std::unique_ptr<IDataProcessor>&& inner) + explicit TListProcessor(std::unique_ptr<IDataProcessor>&& inner) : Inner_(std::move(inner)) { } @@ -158,7 +158,7 @@ private: class TTupleProcessor: public IDataProcessor { public: - TTupleProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) + explicit TTupleProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) : Inners_(std::move(inners)) { } @@ -182,7 +182,7 @@ private: class TStructProcessor: public IDataProcessor { public: - TStructProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) + explicit TStructProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) : Inners_(std::move(inners)) { } @@ -237,7 +237,7 @@ private: class TVariantProcessor: public IDataProcessor { public: - TVariantProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) + explicit TVariantProcessor(TVector<std::unique_ptr<IDataProcessor>>&& inners) : Inners_(std::move(inners)) { } diff --git a/yql/essentials/public/udf/arrow/block_io_buffer.h b/yql/essentials/public/udf/arrow/block_io_buffer.h index 27013c7ea53..0d21cd476c2 100644 --- a/yql/essentials/public/udf/arrow/block_io_buffer.h +++ b/yql/essentials/public/udf/arrow/block_io_buffer.h @@ -9,7 +9,7 @@ namespace NUdf { class TInputBuffer { public: - TInputBuffer(TStringBuf buf) + explicit TInputBuffer(TStringBuf buf) : Buf_(buf) { } diff --git a/yql/essentials/public/udf/arrow/block_item_comparator.h b/yql/essentials/public/udf/arrow/block_item_comparator.h index 339eb213829..4d380e8762f 100644 --- a/yql/essentials/public/udf/arrow/block_item_comparator.h +++ b/yql/essentials/public/udf/arrow/block_item_comparator.h @@ -220,7 +220,7 @@ public: template <bool Nullable> class TTupleBlockItemComparator: public TBlockItemComparatorBase<TTupleBlockItemComparator<Nullable>, Nullable> { public: - TTupleBlockItemComparator(TVector<std::unique_ptr<IBlockItemComparator>>&& children) + explicit TTupleBlockItemComparator(TVector<std::unique_ptr<IBlockItemComparator>>&& children) : Children_(std::move(children)) { } @@ -268,7 +268,7 @@ private: class TExternalOptionalBlockItemComparator: public TBlockItemComparatorBase<TExternalOptionalBlockItemComparator, true> { public: - TExternalOptionalBlockItemComparator(std::unique_ptr<IBlockItemComparator> inner) + explicit TExternalOptionalBlockItemComparator(std::unique_ptr<IBlockItemComparator> inner) : Inner_(std::move(inner)) { } diff --git a/yql/essentials/public/udf/arrow/block_item_hasher.h b/yql/essentials/public/udf/arrow/block_item_hasher.h index d776e9740ac..2f5fb4fb68e 100644 --- a/yql/essentials/public/udf/arrow/block_item_hasher.h +++ b/yql/essentials/public/udf/arrow/block_item_hasher.h @@ -87,7 +87,7 @@ public: template <bool Nullable> class TTupleBlockItemHasher: public TBlockItemHasherBase<TTupleBlockItemHasher<Nullable>, Nullable> { public: - TTupleBlockItemHasher(TVector<std::unique_ptr<IBlockItemHasher>>&& children) + explicit TTupleBlockItemHasher(TVector<std::unique_ptr<IBlockItemHasher>>&& children) : Children_(std::move(children)) { } @@ -109,7 +109,7 @@ private: class TExternalOptionalBlockItemHasher: public TBlockItemHasherBase<TExternalOptionalBlockItemHasher, true> { public: - TExternalOptionalBlockItemHasher(std::unique_ptr<IBlockItemHasher>&& inner) + explicit TExternalOptionalBlockItemHasher(std::unique_ptr<IBlockItemHasher>&& inner) : Inner_(std::move(inner)) { } diff --git a/yql/essentials/public/udf/arrow/block_reader.h b/yql/essentials/public/udf/arrow/block_reader.h index 31311a4fc6f..f7d87aaa3a1 100644 --- a/yql/essentials/public/udf/arrow/block_reader.h +++ b/yql/essentials/public/udf/arrow/block_reader.h @@ -342,7 +342,7 @@ public: template <bool Nullable> class TTupleBlockReader final: public TTupleBlockReaderBase<Nullable, TTupleBlockReader<Nullable>> { public: - TTupleBlockReader(TVector<std::unique_ptr<IBlockReader>>&& children) + explicit TTupleBlockReader(TVector<std::unique_ptr<IBlockReader>>&& children) : Children_(std::move(children)) , Items_(Children_.size()) { @@ -547,7 +547,7 @@ public: class TExternalOptionalBlockReader final: public TBlockReaderBase { public: - TExternalOptionalBlockReader(std::unique_ptr<IBlockReader>&& inner) + explicit TExternalOptionalBlockReader(std::unique_ptr<IBlockReader>&& inner) : Inner_(std::move(inner)) { } diff --git a/yql/essentials/public/udf/udf_allocator.h b/yql/essentials/public/udf/udf_allocator.h index a0e08698225..d81cb4cac02 100644 --- a/yql/essentials/public/udf/udf_allocator.h +++ b/yql/essentials/public/udf/udf_allocator.h @@ -38,7 +38,7 @@ struct TStdAllocatorForUdf { ~TStdAllocatorForUdf() noexcept = default; template <typename U> - TStdAllocatorForUdf(const TStdAllocatorForUdf<U>&) noexcept {}; + explicit TStdAllocatorForUdf(const TStdAllocatorForUdf<U>&) noexcept {}; template <typename U> struct rebind { // NOLINT(readability-identifier-naming) typedef TStdAllocatorForUdf<U> other; diff --git a/yql/essentials/public/udf/udf_counter.h b/yql/essentials/public/udf/udf_counter.h index f924d582e5f..79b57f8ff4b 100644 --- a/yql/essentials/public/udf/udf_counter.h +++ b/yql/essentials/public/udf/udf_counter.h @@ -8,7 +8,12 @@ namespace NUdf { class TCounter { public: - TCounter(i64* ptr = nullptr) + TCounter() + : TCounter(nullptr) + { + } + + explicit TCounter(i64* ptr) : Ptr_(ptr) { } @@ -67,7 +72,7 @@ UDF_ASSERT_TYPE_SIZE(IScopedProbeHost, 8); class TScopedProbe { public: - TScopedProbe(IScopedProbeHost* host = nullptr, void* cookie = nullptr) + explicit TScopedProbe(IScopedProbeHost* host = nullptr, void* cookie = nullptr) : Host_(host ? host : &NullHost_) , Cookie_(cookie) { diff --git a/yql/essentials/public/udf/udf_helpers.h b/yql/essentials/public/udf/udf_helpers.h index b180a358d7e..3d2eb469a6f 100644 --- a/yql/essentials/public/udf/udf_helpers.h +++ b/yql/essentials/public/udf/udf_helpers.h @@ -65,7 +65,7 @@ inline TSourcePosition GetSourcePosition(IFunctionTypeInfoBuilder& builder) { return builder.GetSourcePosition(); #else Y_UNUSED(builder); - return {}; + return TSourcePosition(); #endif } diff --git a/yql/essentials/public/udf/udf_log.cpp b/yql/essentials/public/udf/udf_log.cpp index 25983f7e686..cacc4a02d77 100644 --- a/yql/essentials/public/udf/udf_log.cpp +++ b/yql/essentials/public/udf/udf_log.cpp @@ -40,7 +40,7 @@ public: class TSynchronizedLogger: public ILogger { public: - TSynchronizedLogger(const TLoggerPtr& inner) + explicit TSynchronizedLogger(const TLoggerPtr& inner) : Inner_(inner) { } diff --git a/yql/essentials/public/udf/udf_ptr.h b/yql/essentials/public/udf/udf_ptr.h index 88d7ed3689a..ecbef77e21a 100644 --- a/yql/essentials/public/udf/udf_ptr.h +++ b/yql/essentials/public/udf/udf_ptr.h @@ -21,6 +21,8 @@ struct TDelete { template <typename T, typename D = NDetails::TDelete> class TUniquePtr { public: + // Implicit ownership capturing is okay for smart pointers + // NOLINTNEXTLINE(google-explicit-constructor) inline TUniquePtr(T* ptr = nullptr) : Ptr_(ptr) { @@ -123,6 +125,8 @@ public: }; public: + // Implicit ownership capturing is okay for smart pointers + // NOLINTNEXTLINE(google-explicit-constructor) inline TRefCountedPtr(T* ptr = nullptr) : Ptr_(ptr) { diff --git a/yql/essentials/public/udf/udf_string_ref.h b/yql/essentials/public/udf/udf_string_ref.h index cfe6addc14b..2312a4c3d9f 100644 --- a/yql/essentials/public/udf/udf_string_ref.h +++ b/yql/essentials/public/udf/udf_string_ref.h @@ -29,18 +29,26 @@ protected: } public: + // TStringRef is actually a std::string_view + // NOLINTNEXTLINE(google-explicit-constructor) inline constexpr operator std::string_view() const noexcept { return {Data_, Size_}; } + + // TStringRef is actually a TStringBuf + // NOLINTNEXTLINE(google-explicit-constructor) inline constexpr operator TStringBuf() const noexcept { return {Data_, Size_}; } + inline constexpr TDataType Data() const noexcept { return Data_; } + inline constexpr ui32 Size() const noexcept { return Size_; } + inline constexpr bool Empty() const noexcept { return Size_ == 0; } @@ -48,9 +56,11 @@ public: inline constexpr TDataType data() const noexcept { return Data_; } + inline constexpr ui32 size() const noexcept { return Size_; } + inline constexpr bool empty() const noexcept { return Size_ == 0; } @@ -90,18 +100,22 @@ public: { } - template <size_t Size> + // Allow a string literal construction + template <size_t Size> // NOLINTNEXTLINE(google-explicit-constructor) inline constexpr TStringRef(const char (&data)[Size]) noexcept : TBase(data, Size - 1) { } + // Readonly view is okay + // NOLINTNEXTLINE(google-explicit-constructor) inline constexpr TStringRef(const TMutableStringRef& buf) noexcept : TBase(buf.Data(), buf.Size()) { } - template <typename TStringType> + // Readonly view is okay + template <typename TStringType> // NOLINTNEXTLINE(google-explicit-constructor) inline constexpr TStringRef(const TStringType& buf) noexcept : TBase(TGetData<TStringType>::Get(buf), TGetSize<TStringType>::Get(buf)) { diff --git a/yql/essentials/public/udf/udf_type_builder.h b/yql/essentials/public/udf/udf_type_builder.h index 6c505757004..9705c8825b7 100644 --- a/yql/essentials/public/udf/udf_type_builder.h +++ b/yql/essentials/public/udf/udf_type_builder.h @@ -344,7 +344,7 @@ public: using TPtr = TUniquePtr<IFunctionArgTypesBuilder>; public: - IFunctionArgTypesBuilder(IFunctionTypeInfoBuilder& parent) + explicit IFunctionArgTypesBuilder(IFunctionTypeInfoBuilder& parent) : Parent_(parent) { } diff --git a/yql/essentials/public/udf/udf_type_inspection.h b/yql/essentials/public/udf/udf_type_inspection.h index 93c9a45c8bf..4a586ab4d7b 100644 --- a/yql/essentials/public/udf/udf_type_inspection.h +++ b/yql/essentials/public/udf/udf_type_inspection.h @@ -94,13 +94,13 @@ public: class TStubTypeVisitor: public TStubTypeVisitor7 { public: using TBase = TStubTypeVisitor7; - TStubTypeVisitor(ui16 compatibilityVersion); + explicit TStubTypeVisitor(ui16 compatibilityVersion); }; #elif UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 26) class TStubTypeVisitor: public TStubTypeVisitor6 { public: using TBase = TStubTypeVisitor6; - TStubTypeVisitor(ui16 compatibilityVersion); + explicit TStubTypeVisitor(ui16 compatibilityVersion); }; #elif UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 25) class TStubTypeVisitor: public TStubTypeVisitor5 { diff --git a/yql/essentials/public/udf/udf_types.h b/yql/essentials/public/udf/udf_types.h index 6f26b2de8dc..555d805016a 100644 --- a/yql/essentials/public/udf/udf_types.h +++ b/yql/essentials/public/udf/udf_types.h @@ -143,7 +143,7 @@ enum ETypeKind { ENUM_TO_STRING(ETypeKind, UDF_TYPE_KIND_MAP) struct TSourcePosition { - TSourcePosition(ui32 row = 0, ui32 column = 0, TStringRef file = {}) + explicit TSourcePosition(ui32 row = 0, ui32 column = 0, TStringRef file = {}) : Row(row) , Column(column) , File(file) @@ -190,7 +190,7 @@ UDF_ASSERT_TYPE_SIZE(ICallablePayload, 8); ////////////////////////////////////////////////////////////////////////////// class ITypeVisitor1 { protected: - ITypeVisitor1(ui16 compatibilityVersion) + explicit ITypeVisitor1(ui16 compatibilityVersion) : AbiCompatibility_(compatibilityVersion) { } @@ -281,13 +281,13 @@ public: class ITypeVisitor: public ITypeVisitor7 { protected: using TBase = ITypeVisitor7; - ITypeVisitor(ui16 compatibilityVersion); + explicit ITypeVisitor(ui16 compatibilityVersion); }; #elif UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 26) class ITypeVisitor: public ITypeVisitor6 { protected: using TBase = ITypeVisitor6; - ITypeVisitor(ui16 compatibilityVersion); + explicit ITypeVisitor(ui16 compatibilityVersion); }; #elif UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 25) class ITypeVisitor: public ITypeVisitor5 { diff --git a/yql/essentials/public/udf/udf_value.h b/yql/essentials/public/udf/udf_value.h index 9d15d49cd31..5b0432d979b 100644 --- a/yql/essentials/public/udf/udf_value.h +++ b/yql/essentials/public/udf/udf_value.h @@ -1019,7 +1019,12 @@ public: inline TUnboxedValue() noexcept = default; inline ~TUnboxedValue() noexcept; + // They are almost the same thing. + // NOLINTNEXTLINE(google-explicit-constructor) inline TUnboxedValue(const TUnboxedValuePod& value) noexcept; + + // They are almost the same thing. + // NOLINTNEXTLINE(google-explicit-constructor) inline TUnboxedValue(TUnboxedValuePod&& value) noexcept; inline TUnboxedValue(const TUnboxedValue& value) noexcept; @@ -1044,7 +1049,7 @@ template <typename TResourceData, const char* ResourceTag> class TBoxedResource: public TBoxedValue { public: template <typename... Args> - inline TBoxedResource(Args&&... args) + inline explicit TBoxedResource(Args&&... args) : ResourceData_(std::forward<Args>(args)...) { } @@ -1080,14 +1085,14 @@ template <typename TResourceData> class TBoxedDynamicResource: public TBoxedValue { public: template <typename... Args> - inline TBoxedDynamicResource(TString&& tag, Args&&... args) + inline explicit TBoxedDynamicResource(TString&& tag, Args&&... args) : ResourceData_(std::forward<Args>(args)...) , Tag_(std::move(tag)) { } template <typename... Args> - inline TBoxedDynamicResource(const TString& tag, Args&&... args) + inline explicit TBoxedDynamicResource(const TString& tag, Args&&... args) : ResourceData_(std::forward<Args>(args)...) , Tag_(tag) { diff --git a/yql/essentials/public/udf/udf_value_builder.h b/yql/essentials/public/udf/udf_value_builder.h index 2f154821cd3..c78e6eb67fc 100644 --- a/yql/essentials/public/udf/udf_value_builder.h +++ b/yql/essentials/public/udf/udf_value_builder.h @@ -380,7 +380,7 @@ private: ui8 CacheIndex_ = 0U; public: - TPlainArrayCache(ui32 size) + explicit TPlainArrayCache(ui32 size) : Size_(size) { Clear(); diff --git a/yql/essentials/sql/pg/optimizer.h b/yql/essentials/sql/pg/optimizer.h index 7e6571ef56b..3064567de92 100644 --- a/yql/essentials/sql/pg/optimizer.h +++ b/yql/essentials/sql/pg/optimizer.h @@ -13,7 +13,7 @@ namespace NYql { class TPgOptimizer: public IOptimizer { public: - TPgOptimizer(const TInput& input, const std::function<void(const TString&)>& log = {}); + explicit TPgOptimizer(const TInput& input, const std::function<void(const TString&)>& log = {}); ~TPgOptimizer() override; TOutput JoinSearch() override; diff --git a/yql/essentials/sql/pg/pg_sql.cpp b/yql/essentials/sql/pg/pg_sql.cpp index c7ad2286e29..468c67263e0 100644 --- a/yql/essentials/sql/pg/pg_sql.cpp +++ b/yql/essentials/sql/pg/pg_sql.cpp @@ -6208,7 +6208,7 @@ public: class TSystemFunctionsHandler: public IPGParseEvents { public: - TSystemFunctionsHandler(TVector<NPg::TProcDesc>& procs) + explicit TSystemFunctionsHandler(TVector<NPg::TProcDesc>& procs) : Procs_(procs) { } diff --git a/yql/essentials/sql/pg/ut/util.h b/yql/essentials/sql/pg/ut/util.h index ead30e695c4..70b78a73370 100644 --- a/yql/essentials/sql/pg/ut/util.h +++ b/yql/essentials/sql/pg/ut/util.h @@ -80,7 +80,7 @@ public: class TTypeProxy: public NYql::IAutoParamTypeBuilder { public: - TTypeProxy(TTestAutoParamBuilder& owner) + explicit TTypeProxy(TTestAutoParamBuilder& owner) : Owner(owner) { } @@ -117,7 +117,7 @@ public: class TDataProxy: public NYql::IAutoParamDataBuilder { public: - TDataProxy(TTestAutoParamBuilder& owner) + explicit TDataProxy(TTestAutoParamBuilder& owner) : Owner(owner) { } diff --git a/yql/essentials/sql/settings/translator.cpp b/yql/essentials/sql/settings/translator.cpp index 913db127ad6..7ac498dbc24 100644 --- a/yql/essentials/sql/settings/translator.cpp +++ b/yql/essentials/sql/settings/translator.cpp @@ -6,7 +6,7 @@ namespace { class TDummyTranslator: public ITranslator { public: - TDummyTranslator(const TString& name) + explicit TDummyTranslator(const TString& name) : Name_(name) { } diff --git a/yql/essentials/sql/v0/builtin.cpp b/yql/essentials/sql/v0/builtin.cpp index 2f725a2fa8a..b15496464d6 100644 --- a/yql/essentials/sql/v0/builtin.cpp +++ b/yql/essentials/sql/v0/builtin.cpp @@ -1581,7 +1581,7 @@ private: template <bool IsStart> class THoppingTime final: public TAstListNode { public: - THoppingTime(TPosition pos, const TVector<TNodePtr>& args = {}) + explicit THoppingTime(TPosition pos, const TVector<TNodePtr>& args = {}) : TAstListNode(pos) { Y_UNUSED(args); diff --git a/yql/essentials/sql/v0/context.h b/yql/essentials/sql/v0/context.h index 36ed5676887..c2943b56afa 100644 --- a/yql/essentials/sql/v0/context.h +++ b/yql/essentials/sql/v0/context.h @@ -174,7 +174,7 @@ namespace NSQLTranslationV0 { typedef TSet<ui32> TSetType; protected: - TTranslation(TContext& ctx); + explicit TTranslation(TContext& ctx); public: TContext& Context(); diff --git a/yql/essentials/sql/v0/join.cpp b/yql/essentials/sql/v0/join.cpp index 25bfcbc3117..ea4588a8a46 100644 --- a/yql/essentials/sql/v0/join.cpp +++ b/yql/essentials/sql/v0/join.cpp @@ -37,7 +37,7 @@ struct TJoinDescr { TVector<std::pair<TFullColumn, TFullColumn>> Keys; - TJoinDescr(const TString& op) + explicit TJoinDescr(const TString& op) : Op(op) {} }; diff --git a/yql/essentials/sql/v0/node.cpp b/yql/essentials/sql/v0/node.cpp index 7e11d7f0407..f518729e3c3 100644 --- a/yql/essentials/sql/v0/node.cpp +++ b/yql/essentials/sql/v0/node.cpp @@ -1860,7 +1860,7 @@ TString IdContent(TContext& ctx, const TString& s) { namespace { class TInvalidLiteralNode final: public INode { public: - TInvalidLiteralNode(TPosition pos) + explicit TInvalidLiteralNode(TPosition pos) : INode(pos) { } diff --git a/yql/essentials/sql/v0/node.h b/yql/essentials/sql/v0/node.h index 828c372094b..18f4400b6d5 100644 --- a/yql/essentials/sql/v0/node.h +++ b/yql/essentials/sql/v0/node.h @@ -91,18 +91,25 @@ namespace NSQLTranslationV0 { TPtr Expr; i32 Pos = -1; + // Is so heavily used in a legacy code + // NOLINTNEXTLINE(google-explicit-constructor) TIdPart(const TString& name) : Name(name) { } + + // Is so heavily used in a legacy code + // NOLINTNEXTLINE(google-explicit-constructor) TIdPart(TPtr expr) : Expr(expr) { } - TIdPart(i32 pos) + + explicit TIdPart(i32 pos) : Pos(pos) { } + TIdPart Clone() const { TIdPart res(Name); res.Pos = Pos; @@ -112,7 +119,7 @@ namespace NSQLTranslationV0 { }; public: - INode(TPosition pos); + explicit INode(TPosition pos); virtual ~INode(); TPosition GetPos() const; @@ -259,7 +266,7 @@ namespace NSQLTranslationV0 { class TAstDirectNode final: public INode { public: - TAstDirectNode(TAstNode* node); + explicit TAstDirectNode(TAstNode* node); TAstNode* Translate(TContext& ctx) const override; @@ -272,13 +279,13 @@ namespace NSQLTranslationV0 { class TAstListNode: public INode { public: - TAstListNode(TPosition pos); + explicit TAstListNode(TPosition pos); ~TAstListNode() override; TAstNode* Translate(TContext& ctx) const override; protected: - explicit TAstListNode(const TAstListNode& node); + TAstListNode(const TAstListNode& node); explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); TPtr ShallowCopy() const override; bool DoInit(TContext& ctx, ISource* src) override; @@ -295,7 +302,7 @@ namespace NSQLTranslationV0 { class TAstListNodeImpl final: public TAstListNode { public: - TAstListNodeImpl(TPosition pos); + explicit TAstListNodeImpl(TPosition pos); TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); protected: @@ -399,7 +406,7 @@ namespace NSQLTranslationV0 { WRITE }; - ITableKeys(TPosition pos); + explicit ITableKeys(TPosition pos); virtual const TString* GetTableName() const; virtual TNodePtr BuildKeys(TContext& ctx, EBuildKeysMode mode) = 0; @@ -764,7 +771,7 @@ namespace NSQLTranslationV0 { TIntrusivePtr<ISource> CloneSource() const; protected: - ISource(TPosition pos); + explicit ISource(TPosition pos); TAstNode* Translate(TContext& ctx) const override; void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); @@ -814,7 +821,7 @@ namespace NSQLTranslationV0 { virtual const TSet<TString> GetJoinLabels() const = 0; protected: - IJoin(TPosition pos); + explicit IJoin(TPosition pos); }; class TListOfNamedNodes final: public INode { diff --git a/yql/essentials/sql/v0/select.cpp b/yql/essentials/sql/v0/select.cpp index f9fc13491db..a7263de53bb 100644 --- a/yql/essentials/sql/v0/select.cpp +++ b/yql/essentials/sql/v0/select.cpp @@ -155,7 +155,7 @@ TNodePtr BuildSourceNode(TPosition pos, TSourcePtr source, bool checkExist) { class TFakeSource: public ISource { public: - TFakeSource(TPosition pos) + explicit TFakeSource(TPosition pos) : ISource(pos) {} @@ -337,7 +337,7 @@ protected: class IRealSource: public ISource { protected: - IRealSource(TPosition pos) + explicit IRealSource(TPosition pos) : ISource(pos) { } diff --git a/yql/essentials/sql/v0/sql.cpp b/yql/essentials/sql/v0/sql.cpp index af735b125c4..08e5c0404ba 100644 --- a/yql/essentials/sql/v0/sql.cpp +++ b/yql/essentials/sql/v0/sql.cpp @@ -1417,7 +1417,7 @@ TNodePtr TSqlExpression::UnaryExpr(const TUnarySubExprType& node) { Ctx_.IncrementMonCounter("sql_errors", "FailedToParsePos"); return nullptr; } - ids.push_back(pos); + ids.push_back(INode::TIdPart(pos)); break; } case TUnarySubExprType::TBlock3::TBlock2::kAlt3: { diff --git a/yql/essentials/sql/v1/complete/analysis/global/column.cpp b/yql/essentials/sql/v1/complete/analysis/global/column.cpp index c8831412515..e6b0adbf604 100644 --- a/yql/essentials/sql/v1/complete/analysis/global/column.cpp +++ b/yql/essentials/sql/v1/complete/analysis/global/column.cpp @@ -16,7 +16,7 @@ namespace { class TInferenceVisitor: public TSQLv1BaseVisitor { public: - TInferenceVisitor(const TNamedNodes* nodes) + explicit TInferenceVisitor(const TNamedNodes* nodes) : Nodes_(nodes) { } diff --git a/yql/essentials/sql/v1/complete/analysis/global/narrowing_visitor.h b/yql/essentials/sql/v1/complete/analysis/global/narrowing_visitor.h index 2ae84e5d813..02d2bc78baf 100644 --- a/yql/essentials/sql/v1/complete/analysis/global/narrowing_visitor.h +++ b/yql/essentials/sql/v1/complete/analysis/global/narrowing_visitor.h @@ -7,7 +7,7 @@ namespace NSQLComplete { class TSQLv1NarrowingVisitor: public TSQLv1BaseVisitor { public: - TSQLv1NarrowingVisitor(const TParsedInput& input); + explicit TSQLv1NarrowingVisitor(const TParsedInput& input); protected: bool shouldVisitNextChild(antlr4::tree::ParseTree* node, const std::any& /*currentResult*/) override; diff --git a/yql/essentials/sql/v1/complete/core/name.h b/yql/essentials/sql/v1/complete/core/name.h index 80f0575dd29..129ba634531 100644 --- a/yql/essentials/sql/v1/complete/core/name.h +++ b/yql/essentials/sql/v1/complete/core/name.h @@ -36,7 +36,7 @@ struct TAliased: T { { } - TAliased(T value) + TAliased(T value) // NOLINT(google-explicit-constructor) : T(std::move(value)) { } diff --git a/yql/essentials/sql/v1/complete/syntax/grammar.cpp b/yql/essentials/sql/v1/complete/syntax/grammar.cpp index fc70c488b63..9208b820431 100644 --- a/yql/essentials/sql/v1/complete/syntax/grammar.cpp +++ b/yql/essentials/sql/v1/complete/syntax/grammar.cpp @@ -11,7 +11,7 @@ namespace NSQLComplete { class TSqlGrammar: public ISqlGrammar { public: - TSqlGrammar(const NSQLReflect::TLexerGrammar& grammar) + explicit TSqlGrammar(const NSQLReflect::TLexerGrammar& grammar) : Parser_(MakeDummyParser()) , AllTokens_(ComputeAllTokens()) , KeywordTokens_(ComputeKeywordTokens(grammar)) diff --git a/yql/essentials/sql/v1/context.h b/yql/essentials/sql/v1/context.h index e360b369ac3..56269709766 100644 --- a/yql/essentials/sql/v1/context.h +++ b/yql/essentials/sql/v1/context.h @@ -465,7 +465,7 @@ protected: typedef TSet<ui32> TSetType; protected: - TTranslation(TContext& ctx); + explicit TTranslation(TContext& ctx); public: TContext& Context(); diff --git a/yql/essentials/sql/v1/format/sql_format_ut_antlr4.cpp b/yql/essentials/sql/v1/format/sql_format_ut_antlr4.cpp index f31fcdb23ea..30ae77e214d 100644 --- a/yql/essentials/sql/v1/format/sql_format_ut_antlr4.cpp +++ b/yql/essentials/sql/v1/format/sql_format_ut_antlr4.cpp @@ -16,7 +16,7 @@ namespace { using TCases = TVector<std::pair<TString, TString>>; struct TSetup { - TSetup(bool ansiLexer = false) { + explicit TSetup(bool ansiLexer = false) { NSQLTranslationV1::TLexers lexers; lexers.Antlr4 = NSQLTranslationV1::MakeAntlr4LexerFactory(); lexers.Antlr4Ansi = NSQLTranslationV1::MakeAntlr4AnsiLexerFactory(); diff --git a/yql/essentials/sql/v1/lexer/regex/lexer.cpp b/yql/essentials/sql/v1/lexer/regex/lexer.cpp index 7b9f2ba6e33..04dcdf6a522 100644 --- a/yql/essentials/sql/v1/lexer/regex/lexer.cpp +++ b/yql/essentials/sql/v1/lexer/regex/lexer.cpp @@ -171,7 +171,7 @@ TGenericLexerGrammar MakeGenericLexerGrammar( class TRegexLexer: public NSQLTranslation::ILexer { public: - TRegexLexer(IGenericLexer::TPtr lexer) + explicit TRegexLexer(IGenericLexer::TPtr lexer) : Lexer_(std::move(lexer)) { } diff --git a/yql/essentials/sql/v1/node.cpp b/yql/essentials/sql/v1/node.cpp index f1de40f82a7..1b635db1b93 100644 --- a/yql/essentials/sql/v1/node.cpp +++ b/yql/essentials/sql/v1/node.cpp @@ -2065,7 +2065,7 @@ TString IdContentFromString(TContext& ctx, const TString& str) { namespace { class TInvalidLiteralNode final: public INode { public: - TInvalidLiteralNode(TPosition pos) + explicit TInvalidLiteralNode(TPosition pos) : INode(pos) { } @@ -3632,7 +3632,7 @@ TNodePtr BuildNamedExprReference(TNodePtr parent, const TString& name, TMaybe<si class TNamedExprNode: public IProxyNode { public: - TNamedExprNode(TNodePtr parent) + explicit TNamedExprNode(TNodePtr parent) : IProxyNode(parent->GetPos(), parent) , FakeSource_(BuildFakeSource(parent->GetPos())) , Referenced_(false) diff --git a/yql/essentials/sql/v1/node.h b/yql/essentials/sql/v1/node.h index 4e961c0cf9b..59eb3ec2194 100644 --- a/yql/essentials/sql/v1/node.h +++ b/yql/essentials/sql/v1/node.h @@ -121,14 +121,20 @@ public: TString Name; TPtr Expr; + // Is so heavily used + // NOLINTNEXTLINE(google-explicit-constructor) TIdPart(const TString& name) : Name(name) { } + + // Is so heavily used + // NOLINTNEXTLINE(google-explicit-constructor) TIdPart(TPtr expr) : Expr(expr) { } + TIdPart Clone() const { TIdPart res(Name); res.Expr = Expr ? Expr->Clone() : nullptr; @@ -137,7 +143,7 @@ public: }; public: - INode(TPosition pos); + explicit INode(TPosition pos); virtual ~INode(); TPosition GetPos() const; @@ -437,7 +443,7 @@ public: class TAstDirectNode final: public INode { public: - TAstDirectNode(TAstNode* node); + explicit TAstDirectNode(TAstNode* node); TAstNode* Translate(TContext& ctx) const override; @@ -451,13 +457,13 @@ protected: class TAstListNode: public INode { public: - TAstListNode(TPosition pos); + explicit TAstListNode(TPosition pos); ~TAstListNode() override; TAstNode* Translate(TContext& ctx) const override; protected: - explicit TAstListNode(const TAstListNode& node); + TAstListNode(const TAstListNode& node); explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); TPtr ShallowCopy() const override; bool DoInit(TContext& ctx, ISource* src) override; @@ -475,7 +481,7 @@ protected: class TAstListNodeImpl final: public TAstListNode { public: - TAstListNodeImpl(TPosition pos); + explicit TAstListNodeImpl(TPosition pos); TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override; @@ -662,7 +668,7 @@ public: WRITE }; - ITableKeys(TPosition pos); + explicit ITableKeys(TPosition pos); virtual const TString* GetTableName() const; virtual TNodePtr BuildKeys(TContext& ctx, EBuildKeysMode mode) = 0; @@ -1120,7 +1126,7 @@ protected: class TAsteriskNode: public INode { public: - TAsteriskNode(TPosition pos); + explicit TAsteriskNode(TPosition pos); bool IsAsterisk() const override; TPtr DoClone() const override; TAstNode* Translate(TContext& ctx) const override; @@ -1188,7 +1194,7 @@ struct TTtlSettings { TNodePtr EvictionDelay; std::optional<TIdentifier> StorageName; - TTierSettings(const TNodePtr& evictionDelay, const std::optional<TIdentifier>& storageName = std::nullopt); + explicit TTierSettings(const TNodePtr& evictionDelay, const std::optional<TIdentifier>& storageName = std::nullopt); }; TIdentifier ColumnName; @@ -1227,7 +1233,7 @@ struct TTableSettings { }; struct TFamilyEntry { - TFamilyEntry(const TIdentifier& name) + explicit TFamilyEntry(const TIdentifier& name) : Name(name) { } @@ -1256,7 +1262,7 @@ struct TIndexDescription { TPosition ValuePosition; }; - TIndexDescription(const TIdentifier& name, EType type = EType::GlobalSync) + explicit TIndexDescription(const TIdentifier& name, EType type = EType::GlobalSync) : Name(name) , Type(type) { @@ -1292,7 +1298,7 @@ struct TChangefeedSettings { }; struct TChangefeedDescription { - TChangefeedDescription(const TIdentifier& name) + explicit TChangefeedDescription(const TIdentifier& name) : Name(name) , Disable(false) { @@ -1405,7 +1411,7 @@ struct TTopicConsumerSettings { }; struct TTopicConsumerDescription { - TTopicConsumerDescription(const TIdentifier& name) + explicit TTopicConsumerDescription(const TIdentifier& name) : Name(name) { } diff --git a/yql/essentials/sql/v1/object_processing.h b/yql/essentials/sql/v1/object_processing.h index 9f6b4bcf086..bb9d01b2673 100644 --- a/yql/essentials/sql/v1/object_processing.h +++ b/yql/essentials/sql/v1/object_processing.h @@ -37,6 +37,8 @@ public: TString ServiceId; TDeferredAtom Cluster; + TObjectOperatorContext(const TObjectOperatorContext& baseItem) = default; + explicit TObjectOperatorContext(TScopedStatePtr scoped); }; diff --git a/yql/essentials/sql/v1/query.cpp b/yql/essentials/sql/v1/query.cpp index e4490d7d666..fed6c4bf47b 100644 --- a/yql/essentials/sql/v1/query.cpp +++ b/yql/essentials/sql/v1/query.cpp @@ -3150,7 +3150,7 @@ TNodePtr BuildWriteTable(TPosition pos, const TString& label, const TTableRef& t class TClustersSinkOperationBase: public TAstListNode { protected: - TClustersSinkOperationBase(TPosition pos) + explicit TClustersSinkOperationBase(TPosition pos) : TAstListNode(pos) { } @@ -3179,7 +3179,7 @@ protected: class TCommitClustersNode: public TClustersSinkOperationBase { public: - TCommitClustersNode(TPosition pos) + explicit TCommitClustersNode(TPosition pos) : TClustersSinkOperationBase(pos) { } @@ -3195,7 +3195,7 @@ TNodePtr BuildCommitClusters(TPosition pos) { class TRollbackClustersNode: public TClustersSinkOperationBase { public: - TRollbackClustersNode(TPosition pos) + explicit TRollbackClustersNode(TPosition pos) : TClustersSinkOperationBase(pos) { } diff --git a/yql/essentials/sql/v1/result.h b/yql/essentials/sql/v1/result.h index 601e9afaaaa..0b356ef5c2a 100644 --- a/yql/essentials/sql/v1/result.h +++ b/yql/essentials/sql/v1/result.h @@ -12,6 +12,8 @@ class TContext; template <class TPtr> class TNullable final: public TPtr { public: + // Every pointer is nullable + // NOLINTNEXTLINE(google-explicit-constructor) TNullable(TPtr ptr) : TPtr(std::move(ptr)) { diff --git a/yql/essentials/sql/v1/select.cpp b/yql/essentials/sql/v1/select.cpp index c54aa9fb7dc..c17b894fba3 100644 --- a/yql/essentials/sql/v1/select.cpp +++ b/yql/essentials/sql/v1/select.cpp @@ -469,7 +469,7 @@ protected: class IRealSource: public ISource { protected: - IRealSource(TPosition pos) + explicit IRealSource(TPosition pos) : ISource(pos) { } @@ -783,7 +783,7 @@ bool IsYqlSubqueryRef(const TNodePtr& source) { class TInvalidSubqueryRefNode: public ISource { public: - TInvalidSubqueryRefNode(TPosition pos) + explicit TInvalidSubqueryRefNode(TPosition pos) : ISource(pos) , Pos_(pos) { @@ -3263,7 +3263,7 @@ TSourcePtr BuildSelect(TPosition pos, TSourcePtr source, TNodePtr skipTake) { class TAnyColumnSource final: public ISource { public: - TAnyColumnSource(TPosition pos) + explicit TAnyColumnSource(TPosition pos) : ISource(pos) { } diff --git a/yql/essentials/sql/v1/source.h b/yql/essentials/sql/v1/source.h index 36f62d86f70..57f95b66038 100644 --- a/yql/essentials/sql/v1/source.h +++ b/yql/essentials/sql/v1/source.h @@ -118,7 +118,7 @@ public: TNodePtr BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, bool traits, bool assume); protected: - ISource(TPosition pos); + explicit ISource(TPosition pos); TAstNode* Translate(TContext& ctx) const override; void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); @@ -189,7 +189,7 @@ public: virtual TVector<TString> GetJoinLabels() const = 0; protected: - IJoin(TPosition pos); + explicit IJoin(TPosition pos); }; class TSessionWindow final: public INode { diff --git a/yql/essentials/sql/v1/sql_translation.cpp b/yql/essentials/sql/v1/sql_translation.cpp index d41de20352c..552ab033c65 100644 --- a/yql/essentials/sql/v1/sql_translation.cpp +++ b/yql/essentials/sql/v1/sql_translation.cpp @@ -5684,7 +5684,7 @@ bool TSqlTranslation::ParseTransferLambda( class TReturningListColumns: public INode { public: - TReturningListColumns(TPosition pos) + explicit TReturningListColumns(TPosition pos) : INode(pos) { } diff --git a/yql/essentials/tools/pgrun/pgrun.cpp b/yql/essentials/tools/pgrun/pgrun.cpp index 4617ee33368..4301f4c9b2d 100644 --- a/yql/essentials/tools/pgrun/pgrun.cpp +++ b/yql/essentials/tools/pgrun/pgrun.cpp @@ -82,7 +82,7 @@ class TStatementIterator final }; public: - TStatementIterator(const TString&& program) + explicit TStatementIterator(const TString&& program) : Program_(std::move(program)) , Cur_() , Pos_(0) diff --git a/yql/essentials/tools/purebench/purebench.cpp b/yql/essentials/tools/purebench/purebench.cpp index a500afce61a..ba279b4c33d 100644 --- a/yql/essentials/tools/purebench/purebench.cpp +++ b/yql/essentials/tools/purebench/purebench.cpp @@ -35,7 +35,7 @@ using namespace NKikimr::NMiniKQL; using namespace NYql::NUdf; struct TPickleInputSpec: public TInputSpecBase { - TPickleInputSpec(const TVector<NYT::TNode>& schemas) + explicit TPickleInputSpec(const TVector<NYT::TNode>& schemas) : Schemas(schemas) { } @@ -123,7 +123,7 @@ struct TInputSpecTraits<TPickleInputSpec> { }; struct TPickleOutputSpec: public TOutputSpecBase { - TPickleOutputSpec(const NYT::TNode& schema) + explicit TPickleOutputSpec(const NYT::TNode& schema) : Schema(schema) { } @@ -144,7 +144,7 @@ public: class TPickleOutputHandle final: public TStreamOutputHandle { public: - TPickleOutputHandle(TWorkerHolder<IPullListWorker> worker) + explicit TPickleOutputHandle(TWorkerHolder<IPullListWorker> worker) : Worker_(std::move(worker)) , Packer_(false, Worker_->GetOutputType()) { @@ -195,7 +195,7 @@ struct TOutputSpecTraits<TPickleOutputSpec> { }; struct TPrintOutputSpec: public TOutputSpecBase { - TPrintOutputSpec(const NYT::TNode& schema) + explicit TPrintOutputSpec(const NYT::TNode& schema) : Schema(schema) { } @@ -209,7 +209,7 @@ struct TPrintOutputSpec: public TOutputSpecBase { class TPrintOutputHandle final: public TStreamOutputHandle { public: - TPrintOutputHandle(TWorkerHolder<IPullListWorker> worker) + explicit TPrintOutputHandle(TWorkerHolder<IPullListWorker> worker) : Worker_(std::move(worker)) { } diff --git a/yql/essentials/tools/sql2yql/sql2yql.cpp b/yql/essentials/tools/sql2yql/sql2yql.cpp index f88c2ee1aac..7f200787eca 100644 --- a/yql/essentials/tools/sql2yql/sql2yql.cpp +++ b/yql/essentials/tools/sql2yql/sql2yql.cpp @@ -42,7 +42,7 @@ struct TPosOutput { ui32 Line; ui32 Column; - TPosOutput(IOutputStream& out) + explicit TPosOutput(IOutputStream& out) : Out(out) , Line(1) , Column(0) @@ -142,7 +142,7 @@ bool TestComplete(const TString& query, NYql::TAstNode& root) { class TStoreMappingFunctor: public NLastGetopt::IOptHandler { public: - TStoreMappingFunctor(THashMap<TString, TString>* target, char delim = '@') + explicit TStoreMappingFunctor(THashMap<TString, TString>* target, char delim = '@') : Target_(target) , Delim_(delim) { diff --git a/yql/essentials/tools/udf_resolver/discover.cpp b/yql/essentials/tools/udf_resolver/discover.cpp index b531010def0..414f4d8d7e8 100644 --- a/yql/essentials/tools/udf_resolver/discover.cpp +++ b/yql/essentials/tools/udf_resolver/discover.cpp @@ -67,7 +67,7 @@ NYql::TResolveResult DoDiscover(const NYql::TResolve& inMsg, IMutableFunctionReg TFunctionTypeInfo funcInfo; if (!f.second.IsTypeAwareness) { auto status = functionRegistry.FindFunctionTypeInfo(NYql::UnknownLangVersion, env, typeInfoHelper, - nullptr, funcName, nullptr, nullptr, NUdf::IUdfModule::TFlags::TypesOnly, {}, nullptr, logProvider.Get(), &funcInfo); + nullptr, funcName, nullptr, nullptr, NUdf::IUdfModule::TFlags::TypesOnly, NUdf::TSourcePosition(), nullptr, logProvider.Get(), &funcInfo); if (!status.IsOk()) { udfRes->SetError("Failed to resolve signature, error: " + status.GetError()); diff --git a/yql/essentials/tools/udf_resolver/udf_resolver.cpp b/yql/essentials/tools/udf_resolver/udf_resolver.cpp index b04f52a7cdd..0561496cfac 100644 --- a/yql/essentials/tools/udf_resolver/udf_resolver.cpp +++ b/yql/essentials/tools/udf_resolver/udf_resolver.cpp @@ -174,7 +174,7 @@ void ResolveUDFs() { TFunctionTypeInfo funcInfo; auto status = newRegistry->FindFunctionTypeInfo(udf.GetLangVer(), env, typeInfoHelper, nullptr, - udf.GetName(), mkqlUserType, udf.GetTypeConfig(), NUdf::IUdfModule::TFlags::TypesOnly, {}, nullptr, logProvider.Get(), &funcInfo); + udf.GetName(), mkqlUserType, udf.GetTypeConfig(), NUdf::IUdfModule::TFlags::TypesOnly, NUdf::TSourcePosition(), nullptr, logProvider.Get(), &funcInfo); if (!status.IsOk()) { udfRes->SetError(TStringBuilder() << "Failed to find UDF function: " << udf.GetName() << ", reason: " << status.GetError()); diff --git a/yql/essentials/tools/yql_facade_run/yql_facade_run.h b/yql/essentials/tools/yql_facade_run/yql_facade_run.h index 63b57af7bd8..a9eaf76b694 100644 --- a/yql/essentials/tools/yql_facade_run/yql_facade_run.h +++ b/yql/essentials/tools/yql_facade_run/yql_facade_run.h @@ -185,7 +185,7 @@ private: class TFacadeRunner { public: - TFacadeRunner(TString name); + explicit TFacadeRunner(TString name); ~TFacadeRunner(); int Main(int argc, const char* argv[]); diff --git a/yql/essentials/types/binary_json/format.h b/yql/essentials/types/binary_json/format.h index a10d3d62c53..adeb110ade7 100644 --- a/yql/essentials/types/binary_json/format.h +++ b/yql/essentials/types/binary_json/format.h @@ -60,7 +60,7 @@ enum class EEntryType { struct TEntry { TEntry() = default; - TEntry(EEntryType type, ui32 value = 0) + explicit TEntry(EEntryType type, ui32 value = 0) : Type(type) , Value(value) { diff --git a/yql/essentials/types/binary_json/read.cpp b/yql/essentials/types/binary_json/read.cpp index d31a4f854cc..24acbb1d0d0 100644 --- a/yql/essentials/types/binary_json/read.cpp +++ b/yql/essentials/types/binary_json/read.cpp @@ -349,7 +349,7 @@ TString SerializeToJson(TStringBuf binaryJson) { namespace { struct TPODReader { - TPODReader(TStringBuf buffer) + explicit TPODReader(TStringBuf buffer) : TPODReader(buffer, 0, buffer.size()) { } @@ -385,7 +385,7 @@ struct TPODReader { }; struct TBinaryJsonValidator { - TBinaryJsonValidator(TStringBuf buffer) + explicit TBinaryJsonValidator(TStringBuf buffer) : Buffer_(buffer) { } diff --git a/yql/essentials/types/binary_json/write.cpp b/yql/essentials/types/binary_json/write.cpp index 1d753cd1948..dd1c2b7039e 100644 --- a/yql/essentials/types/binary_json/write.cpp +++ b/yql/essentials/types/binary_json/write.cpp @@ -45,7 +45,7 @@ using namespace NYql::NDom; namespace { struct TContainer { - TContainer(EContainerType type) + explicit TContainer(EContainerType type) : Type(type) { } @@ -184,7 +184,7 @@ struct TPODWriter { */ class TBinaryJsonSerializer { public: - TBinaryJsonSerializer(TJsonIndex&& json) + explicit TBinaryJsonSerializer(TJsonIndex&& json) : Json_(std::move(json)) { } diff --git a/yql/essentials/udfs/common/digest/digest_udf.cpp b/yql/essentials/udfs/common/digest/digest_udf.cpp index c9c08266a76..985251d044b 100644 --- a/yql/essentials/udfs/common/digest/digest_udf.cpp +++ b/yql/essentials/udfs/common/digest/digest_udf.cpp @@ -47,7 +47,7 @@ using TDigestGenerator = TResult(const TStringRef&, TMaybe<TResult> init); template <EDigestType DigestType, typename TResult, TDigestGenerator<TResult>* Generator> class TDigestFunctionUdf: public TBoxedValue { public: - TDigestFunctionUdf(TSourcePosition pos) + explicit TDigestFunctionUdf(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/file/file_udf.cpp b/yql/essentials/udfs/common/file/file_udf.cpp index 68d2af88ea3..518fdb0d244 100644 --- a/yql/essentials/udfs/common/file/file_udf.cpp +++ b/yql/essentials/udfs/common/file/file_udf.cpp @@ -186,7 +186,7 @@ public: typedef TBuffered<TUnbufferedFileInput> TStream; typedef TIntrusivePtr<TStreamMeta> TPtr; - TStreamMeta(TString filePath) + explicit TStreamMeta(TString filePath) : FilePath_(filePath) { // work in greedy mode to catch error on creation @@ -247,7 +247,7 @@ private: } public: - TEmptyIter(TTerminateFunc terminateFunc) + explicit TEmptyIter(TTerminateFunc terminateFunc) : TerminateFunc_(terminateFunc) { } @@ -391,7 +391,7 @@ class TByLinesFunc: public TBoxedValue { private: TSourcePosition Pos_; - TByLinesFunc(TSourcePosition pos) + explicit TByLinesFunc(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/histogram/histogram_udf.cpp b/yql/essentials/udfs/common/histogram/histogram_udf.cpp index 74d1eaee4ef..77eeb01bbf9 100644 --- a/yql/essentials/udfs/common/histogram/histogram_udf.cpp +++ b/yql/essentials/udfs/common/histogram/histogram_udf.cpp @@ -122,7 +122,7 @@ public: template <typename THistogramType, const char* ResourceName> class THistogram_Create: public TBoxedValue { public: - THistogram_Create(TSourcePosition pos) + explicit THistogram_Create(TSourcePosition pos) : Pos_(pos) { } @@ -174,7 +174,7 @@ private: template <typename THistogramType, const char* ResourceName> class THistogram_AddValue: public TBoxedValue { public: - THistogram_AddValue(TSourcePosition pos) + explicit THistogram_AddValue(TSourcePosition pos) : Pos_(pos) { } @@ -226,7 +226,7 @@ private: template <typename THistogramType, const char* ResourceName> class THistogram_Serialize: public TBoxedValue { public: - THistogram_Serialize(TSourcePosition pos) + explicit THistogram_Serialize(TSourcePosition pos) : Pos_(pos) { } @@ -279,7 +279,7 @@ private: template <typename THistogramType, const char* ResourceName> class THistogram_Deserialize: public TBoxedValue { public: - THistogram_Deserialize(TSourcePosition pos) + explicit THistogram_Deserialize(TSourcePosition pos) : Pos_(pos) { } @@ -333,7 +333,7 @@ private: template <typename THistogramType, const char* ResourceName> class THistogram_Merge: public TBoxedValue { public: - THistogram_Merge(TSourcePosition pos) + explicit THistogram_Merge(TSourcePosition pos) : Pos_(pos) { } @@ -387,7 +387,7 @@ struct THistogramIndexes { static constexpr ui32 BinFieldsCount = 2U; static constexpr ui32 ResultFieldsCount = 5U; - THistogramIndexes(IFunctionTypeInfoBuilder& builder) { + explicit THistogramIndexes(IFunctionTypeInfoBuilder& builder) { const auto binStructType = builder.Struct(BinFieldsCount)->AddField<double>("Position", &Position).AddField<double>("Frequency", &Frequency).Build(); const auto binsList = builder.List()->Item(binStructType).Build(); ResultStructType = builder.Struct(ResultFieldsCount)->AddField<char*>("Kind", &Kind).AddField<double>("Min", &Min).AddField<double>("Max", &Max).AddField<double>("WeightsSum", &WeightsSum).AddField("Bins", binsList, &Bins).Build(); @@ -626,7 +626,7 @@ bool THistogram_Deserialize<TLogarithmicHistogram, LogarithmicHistogramResourceN class THistogramPrint: public TBoxedValue { public: - THistogramPrint(const THistogramIndexes& histogramIndexes) + explicit THistogramPrint(const THistogramIndexes& histogramIndexes) : HistogramIndexes_(histogramIndexes) { } @@ -723,7 +723,7 @@ private: class THistogramToCumulativeDistributionFunction: public TBoxedValue { public: - THistogramToCumulativeDistributionFunction(const THistogramIndexes& histogramIndexes) + explicit THistogramToCumulativeDistributionFunction(const THistogramIndexes& histogramIndexes) : HistogramIndexes_(histogramIndexes) { } @@ -795,7 +795,7 @@ private: class THistogramNormalize: public TBoxedValue { public: - THistogramNormalize(const THistogramIndexes& histogramIndexes) + explicit THistogramNormalize(const THistogramIndexes& histogramIndexes) : HistogramIndexes_(histogramIndexes) { } diff --git a/yql/essentials/udfs/common/hyperloglog/hyperloglog_udf.cpp b/yql/essentials/udfs/common/hyperloglog/hyperloglog_udf.cpp index 1d147f43981..0870023ca4d 100644 --- a/yql/essentials/udfs/common/hyperloglog/hyperloglog_udf.cpp +++ b/yql/essentials/udfs/common/hyperloglog/hyperloglog_udf.cpp @@ -134,7 +134,7 @@ using THyperLogLogResource = TBoxedResource<THybridHyperLogLog, HyperLogLogResou class THyperLogLogCreate: public TBoxedValue { public: - THyperLogLogCreate(TSourcePosition pos) + explicit THyperLogLogCreate(TSourcePosition pos) : Pos_(pos) { } @@ -181,7 +181,7 @@ private: class THyperLogLogAddValue: public TBoxedValue { public: - THyperLogLogAddValue(TSourcePosition pos) + explicit THyperLogLogAddValue(TSourcePosition pos) : Pos_(pos) { } @@ -230,7 +230,7 @@ private: class THyperLogLogSerialize: public TBoxedValue { public: - THyperLogLogSerialize(TSourcePosition pos) + explicit THyperLogLogSerialize(TSourcePosition pos) : Pos_(pos) { } @@ -278,7 +278,7 @@ private: class THyperLogLogDeserialize: public TBoxedValue { public: - THyperLogLogDeserialize(TSourcePosition pos) + explicit THyperLogLogDeserialize(TSourcePosition pos) : Pos_(pos) { } @@ -327,7 +327,7 @@ private: class THyperLogLogMerge: public TBoxedValue { public: - THyperLogLogMerge(TSourcePosition pos) + explicit THyperLogLogMerge(TSourcePosition pos) : Pos_(pos) { } @@ -376,7 +376,7 @@ private: class THyperLogLogGetResult: public TBoxedValue { public: - THyperLogLogGetResult(TSourcePosition pos) + explicit THyperLogLogGetResult(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/hyperscan/hyperscan_udf.cpp b/yql/essentials/udfs/common/hyperscan/hyperscan_udf.cpp index f18feca0f4e..b36b86e28d9 100644 --- a/yql/essentials/udfs/common/hyperscan/hyperscan_udf.cpp +++ b/yql/essentials/udfs/common/hyperscan/hyperscan_udf.cpp @@ -240,7 +240,7 @@ class THyperscanCapture: public THyperscanUdfBase { public: class TFactory: public THyperscanUdfBase { public: - TFactory(TSourcePosition pos) + explicit TFactory(TSourcePosition pos) : Pos_(pos) { } @@ -305,7 +305,7 @@ class THyperscanReplace: public THyperscanUdfBase { public: class TFactory: public THyperscanUdfBase { public: - TFactory(TSourcePosition pos) + explicit TFactory(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/json2/as_json_node.h b/yql/essentials/udfs/common/json2/as_json_node.h index 82c51802433..0805307333a 100644 --- a/yql/essentials/udfs/common/json2/as_json_node.h +++ b/yql/essentials/udfs/common/json2/as_json_node.h @@ -16,7 +16,7 @@ using namespace NDom; template <typename TSource> class TAsJsonNode: public TBoxedValue { public: - TAsJsonNode(TSourcePosition pos) + explicit TAsJsonNode(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/json2/compile_path.h b/yql/essentials/udfs/common/json2/compile_path.h index 93ac63fe7cf..ea2bb96c352 100644 --- a/yql/essentials/udfs/common/json2/compile_path.h +++ b/yql/essentials/udfs/common/json2/compile_path.h @@ -12,7 +12,7 @@ using namespace NYql; class TCompilePath: public TBoxedValue { public: - TCompilePath(TSourcePosition pos) + explicit TCompilePath(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/json2/parse.h b/yql/essentials/udfs/common/json2/parse.h index 93a85694d69..eeb194f2c9b 100644 --- a/yql/essentials/udfs/common/json2/parse.h +++ b/yql/essentials/udfs/common/json2/parse.h @@ -16,7 +16,7 @@ using namespace NDom; class TParse: public TBoxedValue { public: - TParse(TSourcePosition pos) + explicit TParse(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/json2/serialize.h b/yql/essentials/udfs/common/json2/serialize.h index 7956c5c33c9..f9bd1942a69 100644 --- a/yql/essentials/udfs/common/json2/serialize.h +++ b/yql/essentials/udfs/common/json2/serialize.h @@ -18,7 +18,7 @@ using namespace NBinaryJson; template <EDataSlot ResultType> class TSerialize: public TBoxedValue { public: - TSerialize(TSourcePosition pos) + explicit TSerialize(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/json2/sql_value.h b/yql/essentials/udfs/common/json2/sql_value.h index 33cf9d3e8e9..33f17f40762 100644 --- a/yql/essentials/udfs/common/json2/sql_value.h +++ b/yql/essentials/udfs/common/json2/sql_value.h @@ -114,7 +114,7 @@ public: Error = 1 }; - TSqlValue(TSourcePosition pos) + explicit TSqlValue(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/math/math_udf.cpp b/yql/essentials/udfs/common/math/math_udf.cpp index 05b1d38c172..6b3e8409e84 100644 --- a/yql/essentials/udfs/common/math/math_udf.cpp +++ b/yql/essentials/udfs/common/math/math_udf.cpp @@ -97,7 +97,7 @@ class TSwapBytesFunc: public TBoxedValue { private: TSourcePosition Pos_; - TSwapBytesFunc(TSourcePosition pos) + explicit TSwapBytesFunc(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/pire/pire_udf.cpp b/yql/essentials/udfs/common/pire/pire_udf.cpp index 9edd23de1a6..9f2d2395b57 100644 --- a/yql/essentials/udfs/common/pire/pire_udf.cpp +++ b/yql/essentials/udfs/common/pire/pire_udf.cpp @@ -16,7 +16,7 @@ using namespace NUdf; namespace { class TPireUdfBase: public TBoxedValue { protected: - TPireUdfBase(TSourcePosition pos) + explicit TPireUdfBase(TSourcePosition pos) : Pos_(pos) { } @@ -176,7 +176,7 @@ class TPireCapture: public TPireUdfBase { public: class TFactory: public TPireUdfBase { public: - TFactory(TSourcePosition pos) + explicit TFactory(TSourcePosition pos) : TPireUdfBase(pos) { } @@ -231,7 +231,7 @@ class TPireReplace: public TPireUdfBase { public: class TFactory: public TPireUdfBase { public: - TFactory(TSourcePosition pos) + explicit TFactory(TSourcePosition pos) : TPireUdfBase(pos) { } diff --git a/yql/essentials/udfs/common/python/bindings/py_callable.cpp b/yql/essentials/udfs/common/python/bindings/py_callable.cpp index cc254baef7b..8b1f7938849 100644 --- a/yql/essentials/udfs/common/python/bindings/py_callable.cpp +++ b/yql/essentials/udfs/common/python/bindings/py_callable.cpp @@ -252,7 +252,7 @@ struct TPySecureParam { PyObject_HEAD; TPyCastContext::TPtr CastCtx; - TPySecureParam(const TPyCastContext::TPtr& castCtx) + explicit TPySecureParam(const TPyCastContext::TPtr& castCtx) : CastCtx(castCtx) { } diff --git a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp index eb7e3a64f32..e0f25941f54 100644 --- a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp +++ b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp @@ -522,7 +522,7 @@ class TLazySequenceAsDict: public NUdf::TBoxedValue { private: class TKeyIterator: public NUdf::TBoxedValue { public: - TKeyIterator(Py_ssize_t size) + explicit TKeyIterator(Py_ssize_t size) : Size_(size) , Index_(0) { diff --git a/yql/essentials/udfs/common/python/bindings/py_ptr.h b/yql/essentials/udfs/common/python/bindings/py_ptr.h index e17a290aaaf..a55b7daa0d9 100644 --- a/yql/essentials/udfs/common/python/bindings/py_ptr.h +++ b/yql/essentials/udfs/common/python/bindings/py_ptr.h @@ -33,6 +33,8 @@ public: { } + // Implicit ownership capturing is okay for smart pointers + // NOLINTNEXTLINE(google-explicit-constructor) inline TPyObjectPtr(PyObject* p) : TSelf(p, STEAL_REF) // do not increment refcounter by default { diff --git a/yql/essentials/udfs/common/python/bindings/py_stream_ut.cpp b/yql/essentials/udfs/common/python/bindings/py_stream_ut.cpp index 61c0fe5caf3..88711df09ad 100644 --- a/yql/essentials/udfs/common/python/bindings/py_stream_ut.cpp +++ b/yql/essentials/udfs/common/python/bindings/py_stream_ut.cpp @@ -29,7 +29,7 @@ void Ui32StreamValidator(const NUdf::TUnboxedValuePod& value) { } struct TTestStream final: NUdf::TBoxedValue { - TTestStream(ui32 maxValue, ui32 yieldOn = Max<ui32>()) + explicit TTestStream(ui32 maxValue, ui32 yieldOn = Max<ui32>()) : Current_(0) , YieldOn_(yieldOn) , MaxValue_(maxValue) diff --git a/yql/essentials/udfs/common/python/bindings/py_test_engine.h b/yql/essentials/udfs/common/python/bindings/py_test_engine.h index 5b482b8cd43..75ff4f4705f 100644 --- a/yql/essentials/udfs/common/python/bindings/py_test_engine.h +++ b/yql/essentials/udfs/common/python/bindings/py_test_engine.h @@ -45,7 +45,7 @@ public: , Alloc_(__LOCATION__) , Env_(Alloc_) , TypeInfoHelper_(new TTypeInfoHelper) - , FunctionInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, {}) + , FunctionInfoBuilder_(NYql::UnknownLangVersion, Env_, TypeInfoHelper_, "", nullptr, NYql::NUdf::TSourcePosition()) { HolderFactory_ = MakeHolder<THolderFactory>( Alloc_.Ref(), diff --git a/yql/essentials/udfs/common/re2/re2_udf.cpp b/yql/essentials/udfs/common/re2/re2_udf.cpp index 7a7b5f54c9e..a772f899816 100644 --- a/yql/essentials/udfs/common/re2/re2_udf.cpp +++ b/yql/essentials/udfs/common/re2/re2_udf.cpp @@ -333,7 +333,7 @@ private: const TOptionsSchema Schema_; public: - TOptions(const TOptionsSchema& schema) + explicit TOptions(const TOptionsSchema& schema) : Schema_(schema) { } @@ -393,7 +393,7 @@ public: template <bool posix> class TIsValidRegexp: public TBoxedValue { public: - TIsValidRegexp(const TOptionsSchema optionsSchema) + explicit TIsValidRegexp(const TOptionsSchema optionsSchema) : OptionsSchema_(std::move(optionsSchema)) { } diff --git a/yql/essentials/udfs/common/reservoir_sampling/reservoir_udf.cpp b/yql/essentials/udfs/common/reservoir_sampling/reservoir_udf.cpp index 61ffabb7bab..d113d09658b 100644 --- a/yql/essentials/udfs/common/reservoir_sampling/reservoir_udf.cpp +++ b/yql/essentials/udfs/common/reservoir_sampling/reservoir_udf.cpp @@ -29,7 +29,7 @@ using namespace NReservoirSampling; class TReservoirWrapper: public TReservoir<TUnboxedValue> { public: template <typename... Args> - TReservoirWrapper(Args&&... args) + explicit TReservoirWrapper(Args&&... args) : TReservoir<TUnboxedValue>(std::forward<Args>(args)...) { } @@ -76,7 +76,7 @@ using TReservoirSamplingResource = TBoxedDynamicResource<TReservoirWrapper>; class TThreadSafeRandomProviderWrapper: public IRandomProvider { public: - TThreadSafeRandomProviderWrapper(TIntrusivePtr<IRandomProvider>&& underlying) + explicit TThreadSafeRandomProviderWrapper(TIntrusivePtr<IRandomProvider>&& underlying) : Underlying_(std::move(underlying)) { } @@ -107,7 +107,7 @@ TIntrusivePtr<IRandomProvider> WrapRandomProviderThreadSafe(TIntrusivePtr<IRando class TReservoirSamplingBase { public: - TReservoirSamplingBase(TString&& tag) + explicit TReservoirSamplingBase(TString&& tag) : RandomPovider_(GetEnv("YQL_DETERMINISTIC_MODE") ? WrapRandomProviderThreadSafe(CreateDeterministicRandomProvider(1)) : CreateDefaultRandomProvider()) , ResourceTag_(std::move(tag)) { @@ -140,7 +140,7 @@ private: template <typename Derived> class TReservoirSamplingImpl final: public TBoxedValue { public: - TReservoirSamplingImpl(TString tag) + explicit TReservoirSamplingImpl(TString tag) : Implementation_(std::move(tag)) { } @@ -156,7 +156,7 @@ private: class T##Name: TReservoirSamplingBase { \ public: \ template <typename... Args> \ - T##Name(Args&&... args) \ + explicit T##Name(Args&&... args) \ : TReservoirSamplingBase(std::forward<Args>(args)...) \ { \ } \ diff --git a/yql/essentials/udfs/common/set/set_udf.cpp b/yql/essentials/udfs/common/set/set_udf.cpp index 86e9dae50d6..688870c6cf2 100644 --- a/yql/essentials/udfs/common/set/set_udf.cpp +++ b/yql/essentials/udfs/common/set/set_udf.cpp @@ -160,7 +160,7 @@ extern const char SetResourceNameGeneric[] = "Set.SetResource.Generic"; class TSetResource: public TBoxedResource<TSetGeneric, SetResourceNameGeneric> { public: template <typename... Args> - inline TSetResource(Args&&... args) + inline explicit TSetResource(Args&&... args) : TBoxedResource(std::forward<Args>(args)...) { } @@ -336,7 +336,7 @@ private: class TSetResourceData<EDataSlot::slot>: public TBoxedResource<TSetData<EDataSlot::slot>, SetResourceName##slot> { \ public: \ template <typename... Args> \ - inline TSetResourceData(Args&&... args) \ + inline explicit TSetResourceData(Args&&... args) \ : TBoxedResource(std::forward<Args>(args)...) \ { \ } \ diff --git a/yql/essentials/udfs/common/streaming/streaming_udf.cpp b/yql/essentials/udfs/common/streaming/streaming_udf.cpp index c880f66b3e3..8c88c67ed5e 100644 --- a/yql/essentials/udfs/common/streaming/streaming_udf.cpp +++ b/yql/essentials/udfs/common/streaming/streaming_udf.cpp @@ -28,7 +28,7 @@ namespace { // should be managed externally. class TCyclicRWBuffer { public: - TCyclicRWBuffer(size_t capacity) + explicit TCyclicRWBuffer(size_t capacity) : Buffer_(capacity) , Finished_(false) , DataStart_(0) @@ -458,7 +458,7 @@ private: private: class MatcherCallback: public TKMPStreamMatcher<char>::ICallback { public: - MatcherCallback(bool& hasMatch) + explicit MatcherCallback(bool& hasMatch) : HasMatch_(hasMatch) { } @@ -684,7 +684,7 @@ private: class TStreamingProcess: public TBoxedValue { public: - TStreamingProcess(TSourcePosition pos) + explicit TStreamingProcess(TSourcePosition pos) : Pos_(pos) { } @@ -729,7 +729,7 @@ private: class TStreamingProcessInline: public TBoxedValue { public: - TStreamingProcessInline(TSourcePosition pos) + explicit TStreamingProcessInline(TSourcePosition pos) : Pos_(pos) { } diff --git a/yql/essentials/udfs/common/top/top_udf.cpp b/yql/essentials/udfs/common/top/top_udf.cpp index 41a0136f411..a446910cd60 100644 --- a/yql/essentials/udfs/common/top/top_udf.cpp +++ b/yql/essentials/udfs/common/top/top_udf.cpp @@ -619,7 +619,7 @@ public: TopResourceName_##slot##_##hasKey##_##isTop> { \ public: \ template <typename... Args> \ - inline TTopResourceData(Args&&... args) \ + inline explicit TTopResourceData(Args&&... args) \ : TBoxedResource(std::forward<Args>(args)...) \ { \ } \ @@ -712,7 +712,7 @@ UDF_TYPE_ID_MAP(RESOURCE_11) TopResourceName_Generic_##hasKey##_##isTop> { \ public: \ template <typename... Args> \ - inline TTopResource(Args&&... args) \ + inline explicit TTopResource(Args&&... args) \ : TBoxedResource(std::forward<Args>(args)...) \ { \ } \ diff --git a/yql/essentials/udfs/common/topfreq/static/topfreq.h b/yql/essentials/udfs/common/topfreq/static/topfreq.h index c2d9d78d14c..dc724fb225a 100644 --- a/yql/essentials/udfs/common/topfreq/static/topfreq.h +++ b/yql/essentials/udfs/common/topfreq/static/topfreq.h @@ -51,7 +51,7 @@ public: TTopFreqData(const NKikimr::NUdf::TUnboxedValuePod& value, const ui32 minSize, const ui32 maxSize); TTopFreqData(const TTopFreqData& topFreq1, const TTopFreqData& topFreq2); - TTopFreqData(const NKikimr::NUdf::TUnboxedValuePod& serialized); + explicit TTopFreqData(const NKikimr::NUdf::TUnboxedValuePod& serialized); NKikimr::NUdf::TUnboxedValue Serialize(const NKikimr::NUdf::IValueBuilder* builder); NKikimr::NUdf::TUnboxedValue Get(const NKikimr::NUdf::IValueBuilder* builder, ui32 resultSize); diff --git a/yql/essentials/udfs/common/topfreq/static/topfreq_udf.h b/yql/essentials/udfs/common/topfreq/static/topfreq_udf.h index 4a338c29b7c..b37a37d1357 100644 --- a/yql/essentials/udfs/common/topfreq/static/topfreq_udf.h +++ b/yql/essentials/udfs/common/topfreq/static/topfreq_udf.h @@ -19,7 +19,7 @@ extern const char TopFreqResourceNameGeneric[] = "TopFreq.TopFreqResource.Generi class TTopFreqResource: public TBoxedResource<TTopFreqGeneric, TopFreqResourceNameGeneric> { public: template <typename... Args> - inline TTopFreqResource(Args&&... args) + inline explicit TTopFreqResource(Args&&... args) : TBoxedResource(std::forward<Args>(args)...) { } @@ -178,7 +178,7 @@ private: class TTopFreqResourceData<EDataSlot::slot>: public TBoxedResource<TTopFreqData<EDataSlot::slot>, TopFreqResourceName##slot> { \ public: \ template <typename... Args> \ - inline TTopFreqResourceData(Args&&... args) \ + inline explicit TTopFreqResourceData(Args&&... args) \ : TBoxedResource(std::forward<Args>(args)...) \ { \ } \ diff --git a/yql/essentials/udfs/common/url_base/lib/url_parse.h b/yql/essentials/udfs/common/url_base/lib/url_parse.h index 4a0adccdab4..0152c96cfec 100644 --- a/yql/essentials/udfs/common/url_base/lib/url_parse.h +++ b/yql/essentials/udfs/common/url_base/lib/url_parse.h @@ -27,7 +27,7 @@ struct TUrlParseIndexes { class TParse: public TBoxedValue { public: - TParse(const TUrlParseIndexes& UrlParseIndexes) + explicit TParse(const TUrlParseIndexes& UrlParseIndexes) : UrlParseIndexes_(UrlParseIndexes) , ParseFlags_(TUri::FeaturesRecommended) { diff --git a/yql/essentials/udfs/common/vector/vector_udf.cpp b/yql/essentials/udfs/common/vector/vector_udf.cpp index dbaf1d05e31..08dccd4ab05 100644 --- a/yql/essentials/udfs/common/vector/vector_udf.cpp +++ b/yql/essentials/udfs/common/vector/vector_udf.cpp @@ -49,7 +49,7 @@ extern const char VectorResourceName[] = "Vector.VectorResource"; class TVectorResource: public TBoxedResource<TVector, VectorResourceName> { public: template <typename... Args> - inline TVectorResource(Args&&... args) + inline explicit TVectorResource(Args&&... args) : TBoxedResource(std::forward<Args>(args)...) { } diff --git a/yql/essentials/udfs/examples/tagged/tagged_udf.cpp b/yql/essentials/udfs/examples/tagged/tagged_udf.cpp index cf9a1b1c0d2..c66eab38d84 100644 --- a/yql/essentials/udfs/examples/tagged/tagged_udf.cpp +++ b/yql/essentials/udfs/examples/tagged/tagged_udf.cpp @@ -32,7 +32,7 @@ public: return Name; } - TGenericTag(TStringRef tag) + explicit TGenericTag(TStringRef tag) : Tag_(tag) { } diff --git a/yql/essentials/udfs/language/yql/yql_language_udf.cpp b/yql/essentials/udfs/language/yql/yql_language_udf.cpp index af8f3a81ccb..6df9919b293 100644 --- a/yql/essentials/udfs/language/yql/yql_language_udf.cpp +++ b/yql/essentials/udfs/language/yql/yql_language_udf.cpp @@ -21,7 +21,7 @@ using namespace NSQLv1Generated; class TRuleFreqTranslation: public TSqlTranslation { public: - TRuleFreqTranslation(TContext& ctx) + explicit TRuleFreqTranslation(TContext& ctx) : TSqlTranslation(ctx, ctx.Settings.Mode) { } @@ -29,7 +29,7 @@ public: class TRuleFreqVisitor { public: - TRuleFreqVisitor(TContext& ctx) + explicit TRuleFreqVisitor(TContext& ctx) : Translation_(ctx) { KeywordNames_ = NSQLReflect::LoadLexerGrammar().KeywordNames; diff --git a/yql/essentials/udfs/test/simple/simple_udf.cpp b/yql/essentials/udfs/test/simple/simple_udf.cpp index 7b2b124af31..81603c22316 100644 --- a/yql/essentials/udfs/test/simple/simple_udf.cpp +++ b/yql/essentials/udfs/test/simple/simple_udf.cpp @@ -181,7 +181,7 @@ public: return Name; } - TGenericAsStruct(size_t argc) + explicit TGenericAsStruct(size_t argc) : Argc_(argc) { } diff --git a/yql/essentials/utils/backtrace/backtrace_lib.h b/yql/essentials/utils/backtrace/backtrace_lib.h index d0a390bf9ea..e761862369e 100644 --- a/yql/essentials/utils/backtrace/backtrace_lib.h +++ b/yql/essentials/utils/backtrace/backtrace_lib.h @@ -7,7 +7,7 @@ namespace NYql { namespace NBacktrace { size_t CollectBacktrace(void** addresses, size_t limit, void* data); struct TCollectedFrame { - TCollectedFrame(uintptr_t addr); + explicit TCollectedFrame(uintptr_t addr); TCollectedFrame() = default; const char* File; size_t Address; diff --git a/yql/essentials/utils/exceptions.h b/yql/essentials/utils/exceptions.h index 0028bd60d26..c4f580962c5 100644 --- a/yql/essentials/utils/exceptions.h +++ b/yql/essentials/utils/exceptions.h @@ -10,7 +10,7 @@ struct TCodeLineException: public yexception { mutable TString Message; ui32 Code; - TCodeLineException(ui32 code); + explicit TCodeLineException(ui32 code); TCodeLineException(const TSourceLocation& sl, const TCodeLineException& t); diff --git a/yql/essentials/utils/hash.h b/yql/essentials/utils/hash.h index ac6f1324a11..dfed9dfa20b 100644 --- a/yql/essentials/utils/hash.h +++ b/yql/essentials/utils/hash.h @@ -21,6 +21,10 @@ struct TVaryingHash { TVaryingHash() = default; TVaryingHash(const TVaryingHash&) = default; + + // It is used in UnorderedMap specializations, + // but user wants to provide just a THasher. + // NOLINTNEXTLINE(google-explicit-constructor) TVaryingHash(const THasher& underlying) : Underlying(underlying) { diff --git a/yql/essentials/utils/log/context.h b/yql/essentials/utils/log/context.h index d9124caec18..6123dbf8f95 100644 --- a/yql/essentials/utils/log/context.h +++ b/yql/essentials/utils/log/context.h @@ -156,7 +156,7 @@ template <size_t Size> class TLogContext: public NImpl::TLogContextListItem { public: template <typename... TArgs> - TLogContext(TArgs... args) + explicit TLogContext(TArgs... args) : TLogContextListItem(Size) , Names_{{TString{std::forward<TArgs>(args)}...}} { @@ -183,7 +183,7 @@ template <size_t Size> class TRootLogContext: public NImpl::TLogContextSessionItem { public: template <typename... TArgs> - TRootLogContext(const TString& sessionId, TArgs... args) + explicit TRootLogContext(const TString& sessionId, TArgs... args) : TLogContextSessionItem(Size, !sessionId.empty()) , Names_{{sessionId, TString{std::forward<TArgs>(args)}...}} { @@ -258,7 +258,7 @@ void OutputLogCtx(IOutputStream* out, bool withBraces, bool skipSessionId = fals */ class TYqlLogContextLocation { public: - TYqlLogContextLocation(const TSourceLocation& location) + explicit TYqlLogContextLocation(const TSourceLocation& location) : Location_(location.File, location.Line) { } diff --git a/yql/essentials/utils/log/log.h b/yql/essentials/utils/log/log.h index ec6a607f065..2d10b406510 100644 --- a/yql/essentials/utils/log/log.h +++ b/yql/essentials/utils/log/log.h @@ -201,15 +201,15 @@ void ReopenLog(); class YqlLoggerScope { public: - YqlLoggerScope(const TString& log, bool startAsDaemon = false) { + explicit YqlLoggerScope(const TString& log, bool startAsDaemon = false) { InitLogger(log, startAsDaemon); } - YqlLoggerScope(TAutoPtr<TLogBackend> backend, TFormatter formatter = LegacyFormat, bool isStrictFormatting = true) { + explicit YqlLoggerScope(TAutoPtr<TLogBackend> backend, TFormatter formatter = LegacyFormat, bool isStrictFormatting = true) { InitLogger(backend, std::move(formatter), isStrictFormatting); } - YqlLoggerScope(IOutputStream* out, TFormatter formatter = LegacyFormat, bool isStrictFormatting = true) { + explicit YqlLoggerScope(IOutputStream* out, TFormatter formatter = LegacyFormat, bool isStrictFormatting = true) { InitLogger(out, std::move(formatter), isStrictFormatting); } diff --git a/yql/essentials/utils/log/tls_backend.h b/yql/essentials/utils/log/tls_backend.h index 5a3f781b5d9..f0eaf681135 100644 --- a/yql/essentials/utils/log/tls_backend.h +++ b/yql/essentials/utils/log/tls_backend.h @@ -16,7 +16,7 @@ namespace NLog { */ class TTlsLogBackend: public TLogBackend { public: - TTlsLogBackend(TAutoPtr<TLogBackend> defaultBackend) + explicit TTlsLogBackend(TAutoPtr<TLogBackend> defaultBackend) : DefaultBackend_(defaultBackend) { Y_DEBUG_ABORT_UNLESS(DefaultBackend_, "default backend is not set"); @@ -48,7 +48,7 @@ template <typename TBackend> class TScopedBackend: public TBackend { public: template <typename... TArgs> - TScopedBackend(TArgs&&... args) + explicit TScopedBackend(TArgs&&... args) : TBackend(std::forward<TArgs>(args)...) , PrevBacked_(SetLogBackendForCurrentThread(this)) { |
