diff options
18 files changed, 48 insertions, 63 deletions
diff --git a/eval/src/tests/eval/function/function_test.cpp b/eval/src/tests/eval/function/function_test.cpp index 60c4c81f519..e75b34f4695 100644 --- a/eval/src/tests/eval/function/function_test.cpp +++ b/eval/src/tests/eval/function/function_test.cpp @@ -8,6 +8,7 @@ #include <vespa/eval/eval/test/eval_spec.h> #include <vespa/eval/eval/test/gen_spec.h> #include <vespa/eval/eval/check_type.h> +#include <vespa/vespalib/util/stringfmt.h> using namespace vespalib::eval; using namespace vespalib::eval::nodes; diff --git a/eval/src/tests/eval/gbdt/model.cpp b/eval/src/tests/eval/gbdt/model.cpp index 22ab22835f7..2659c07b601 100644 --- a/eval/src/tests/eval/gbdt/model.cpp +++ b/eval/src/tests/eval/gbdt/model.cpp @@ -3,6 +3,7 @@ #include <random> #include <vespa/eval/eval/function.h> +#include <vespa/vespalib/util/stringfmt.h> using vespalib::make_string; using vespalib::eval::Function; diff --git a/eval/src/tests/eval/node_types/node_types_test.cpp b/eval/src/tests/eval/node_types/node_types_test.cpp index 07975ef16ed..85c7d40cbea 100644 --- a/eval/src/tests/eval/node_types/node_types_test.cpp +++ b/eval/src/tests/eval/node_types/node_types_test.cpp @@ -4,6 +4,7 @@ #include <vespa/eval/eval/value_type.h> #include <vespa/eval/eval/value_type_spec.h> #include <vespa/eval/eval/node_types.h> +#include <vespa/vespalib/util/stringfmt.h> using namespace vespalib::eval; diff --git a/eval/src/vespa/eval/eval/basic_nodes.cpp b/eval/src/vespa/eval/eval/basic_nodes.cpp index 454936ca818..eac0a7d97e8 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.cpp +++ b/eval/src/vespa/eval/eval/basic_nodes.cpp @@ -7,6 +7,7 @@ #include "simple_value.h" #include "fast_value.h" #include "node_tools.h" +#include <vespa/vespalib/util/stringfmt.h> namespace vespalib::eval::nodes { @@ -22,6 +23,26 @@ struct Frame { } // namespace vespalib::eval::nodes::<unnamed> +vespalib::string +Number::dump(DumpContext &) const { + return make_string("%g", _value); +} + +vespalib::string +If::dump(DumpContext &ctx) const { + vespalib::string str; + str += "if("; + str += _cond->dump(ctx); + str += ","; + str += _true_expr->dump(ctx); + str += ","; + str += _false_expr->dump(ctx); + if (_p_true != 0.5) { + str += make_string(",%g", _p_true); + } + str += ")"; + return str; +} double Node::get_const_double_value() const { diff --git a/eval/src/vespa/eval/eval/basic_nodes.h b/eval/src/vespa/eval/eval/basic_nodes.h index 919b04f8e17..2db00bbcb7d 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.h +++ b/eval/src/vespa/eval/eval/basic_nodes.h @@ -6,7 +6,6 @@ #include "string_stuff.h" #include <vespa/vespalib/util/hdr_abort.h> #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/string_hash.h> #include <memory> #include <map> @@ -97,9 +96,7 @@ public: virtual bool is_const_double() const override { return true; } double get_const_double_value() const override { return value(); } double value() const { return _value; } - vespalib::string dump(DumpContext &) const override { - return make_string("%g", _value); - } + vespalib::string dump(DumpContext &) const override; void accept(NodeVisitor &visitor) const override; }; @@ -256,20 +253,7 @@ public: handler.handle(std::move(_true_expr)); handler.handle(std::move(_false_expr)); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; - str += "if("; - str += _cond->dump(ctx); - str += ","; - str += _true_expr->dump(ctx); - str += ","; - str += _false_expr->dump(ctx); - if (_p_true != 0.5) { - str += make_string(",%g", _p_true); - } - str += ")"; - return str; - } + vespalib::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; }; diff --git a/eval/src/vespa/eval/eval/call_nodes.cpp b/eval/src/vespa/eval/eval/call_nodes.cpp index 991c9a10b87..527a87eca55 100644 --- a/eval/src/vespa/eval/eval/call_nodes.cpp +++ b/eval/src/vespa/eval/eval/call_nodes.cpp @@ -3,11 +3,9 @@ #include "call_nodes.h" #include "node_visitor.h" -namespace vespalib { -namespace eval { -namespace nodes { +namespace vespalib::eval::nodes { -Call::~Call() { } +Call::~Call() = default; template <typename T> void CallHelper<T>::accept(NodeVisitor &visitor) const { @@ -47,6 +45,4 @@ CallRepo::CallRepo() : _map() { add(nodes::Hamming()); } -} // namespace vespalib::eval::nodes -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/call_nodes.h b/eval/src/vespa/eval/eval/call_nodes.h index 9f7b5a94a73..975f52e40a1 100644 --- a/eval/src/vespa/eval/eval/call_nodes.h +++ b/eval/src/vespa/eval/eval/call_nodes.h @@ -4,16 +4,12 @@ #include "basic_nodes.h" #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/stringfmt.h> #include <map> #include <cmath> -namespace vespalib { -namespace eval { +namespace vespalib::eval { struct NodeVisitor; } -struct NodeVisitor; - -namespace nodes { +namespace vespalib::eval::nodes { /** * Common superclass for AST nodes describing calls to built-in @@ -144,6 +140,4 @@ struct Hamming : CallHelper<Hamming> { Hamming() : Helper("hamming", 2) {} }; //----------------------------------------------------------------------------- -} // namespace vespalib::eval::nodes -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/cell_type.h b/eval/src/vespa/eval/eval/cell_type.h index a371e618f37..fc3a631b7af 100644 --- a/eval/src/vespa/eval/eval/cell_type.h +++ b/eval/src/vespa/eval/eval/cell_type.h @@ -2,12 +2,12 @@ #pragma once +#include "int8float.h" +#include <vespa/vespalib/util/bfloat16.h> #include <vespa/vespalib/util/typify.h> #include <vector> #include <cstdint> #include <cassert> -#include "int8float.h" -#include <vespa/vespalib/util/bfloat16.h> namespace vespalib::eval { diff --git a/eval/src/vespa/eval/eval/function.cpp b/eval/src/vespa/eval/eval/function.cpp index fd07c891ad5..8c9b2ad171f 100644 --- a/eval/src/vespa/eval/eval/function.cpp +++ b/eval/src/vespa/eval/eval/function.cpp @@ -8,6 +8,7 @@ #include "delete_node.h" #include "aggr.h" #include <vespa/vespalib/locale/c.h> +#include <vespa/vespalib/util/stringfmt.h> #include <cctype> #include <map> #include <set> diff --git a/eval/src/vespa/eval/eval/function.h b/eval/src/vespa/eval/eval/function.h index 61f2c9c2f24..e56118da65e 100644 --- a/eval/src/vespa/eval/eval/function.h +++ b/eval/src/vespa/eval/eval/function.h @@ -2,17 +2,11 @@ #pragma once -#include <cmath> -#include <memory> -#include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/stringfmt.h> -#include <map> #include "basic_nodes.h" #include "delete_node.h" #include "value.h" -namespace vespalib { -namespace eval { +namespace vespalib::eval { enum class PassParams : uint8_t { SEPARATE, ARRAY, LAZY }; @@ -85,5 +79,4 @@ public: }; }; -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/interpreted_function.cpp b/eval/src/vespa/eval/eval/interpreted_function.cpp index 12945edf9de..d51b8ae0b39 100644 --- a/eval/src/vespa/eval/eval/interpreted_function.cpp +++ b/eval/src/vespa/eval/eval/interpreted_function.cpp @@ -11,6 +11,7 @@ #include <vespa/eval/eval/llvm/compile_cache.h> #include <vespa/eval/eval/llvm/addr_to_symbol.h> #include <vespa/vespalib/util/benchmark_timer.h> +#include <vespa/vespalib/util/stringfmt.h> #include <set> namespace vespalib::eval { diff --git a/eval/src/vespa/eval/eval/llvm/compiled_function.cpp b/eval/src/vespa/eval/eval/llvm/compiled_function.cpp index b0bf1583c68..33fd4ee31ee 100644 --- a/eval/src/vespa/eval/eval/llvm/compiled_function.cpp +++ b/eval/src/vespa/eval/eval/llvm/compiled_function.cpp @@ -9,6 +9,7 @@ #include <vespa/vespalib/util/classname.h> #include <vespa/vespalib/util/benchmark_timer.h> #include <vespa/vespalib/util/approx.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> LOG_SETUP(".eval.eval.llvm.compiled_function"); diff --git a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp index d1a9ffc5b49..a3e4e3df7fa 100644 --- a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp +++ b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp @@ -6,6 +6,7 @@ #include <vespa/eval/eval/node_traverser.h> #include <vespa/eval/eval/extract_bit.h> #include <vespa/eval/eval/hamming_distance.h> +#include <vespa/vespalib/util/stringfmt.h> #include <llvm/IR/Verifier.h> #include <llvm/Support/TargetSelect.h> #include <llvm/IR/IRBuilder.h> diff --git a/eval/src/vespa/eval/eval/operator_nodes.cpp b/eval/src/vespa/eval/eval/operator_nodes.cpp index 13404ecc093..6599dadef02 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.cpp +++ b/eval/src/vespa/eval/eval/operator_nodes.cpp @@ -3,9 +3,7 @@ #include "operator_nodes.h" #include "node_visitor.h" -namespace vespalib { -namespace eval { -namespace nodes { +namespace vespalib::eval::nodes { Operator::Operator(const vespalib::string &op_str_in, int priority_in, Order order_in) : _op_str(op_str_in), @@ -16,7 +14,7 @@ Operator::Operator(const vespalib::string &op_str_in, int priority_in, Order ord _is_const_double(false) {} -Operator::~Operator() { } +Operator::~Operator() = default; template <typename T> void OperatorHelper<T>::accept(NodeVisitor &visitor) const { visitor.visit(static_cast<const T&>(*this)); @@ -41,6 +39,4 @@ OperatorRepo::OperatorRepo() : _map(), _max_size(0) { add(nodes::Or()); } -} // namespace vespalib::eval::nodes -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/operator_nodes.h b/eval/src/vespa/eval/eval/operator_nodes.h index 7759958be4b..a47e724a6eb 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.h +++ b/eval/src/vespa/eval/eval/operator_nodes.h @@ -4,17 +4,13 @@ #include "basic_nodes.h" #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/stringfmt.h> #include <cmath> #include <memory> #include <map> -namespace vespalib { -namespace eval { +namespace vespalib::eval { struct NodeVisitor; } -struct NodeVisitor; - -namespace nodes { +namespace vespalib::eval::nodes { /** * Common superclass for AST nodes describing infix operators. Each @@ -171,6 +167,4 @@ struct Or : OperatorHelper<Or> { Or() : Helper("|| //----------------------------------------------------------------------------- -} // namespace vespalib::eval::nodes -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp index 434040c7dad..efb5898fde4 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp @@ -7,6 +7,7 @@ #include <vespa/searchlib/features/rankingexpression/feature_name_extractor.h> #include <vespa/eval/eval/param_usage.h> #include <vespa/eval/eval/fast_value.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> LOG_SETUP(".features.rankingexpression"); diff --git a/vespalib/src/vespa/vespalib/util/shared_string_repo.h b/vespalib/src/vespa/vespalib/util/shared_string_repo.h index 7ba59937c7c..99a120d1cc5 100644 --- a/vespalib/src/vespa/vespalib/util/shared_string_repo.h +++ b/vespalib/src/vespa/vespalib/util/shared_string_repo.h @@ -6,7 +6,6 @@ #include "string_id.h" #include "spin_lock.h" #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/stllike/identity.h> #include <vespa/vespalib/stllike/allocator.h> #include <vespa/vespalib/stllike/hashtable.hpp> diff --git a/vespalib/src/vespa/vespalib/util/typify.h b/vespalib/src/vespa/vespalib/util/typify.h index 4d97c1a458c..906c0c85710 100644 --- a/vespalib/src/vespa/vespalib/util/typify.h +++ b/vespalib/src/vespa/vespalib/util/typify.h @@ -3,7 +3,7 @@ #pragma once #include "traits.h" -#include <stddef.h> +#include <cstddef> #include <utility> namespace vespalib { |