summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2024-05-19 22:52:22 +0200
committerTor Egge <Tor.Egge@online.no>2024-05-19 22:52:22 +0200
commit7d057ea51f67675b8214e99c64c0729471aa5dd3 (patch)
tree6a617f9f0d7ed5c11683fa799e4a605dabce988e
parent6e3cc46cf6717b58ab658d1efe6b44df0dbae77a (diff)
Use const auto* to indicate that variable is a pointer.
-rw-r--r--document/src/tests/documentupdatetestcase.cpp2
-rw-r--r--document/src/vespa/document/serialization/vespadocumentserializer.cpp2
-rw-r--r--document/src/vespa/document/update/tensor_add_update.cpp4
-rw-r--r--document/src/vespa/document/update/tensor_modify_update.cpp4
-rw-r--r--document/src/vespa/document/update/tensor_remove_update.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp6
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp2
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp2
8 files changed, 13 insertions, 13 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index 23b998d6800..9da03d6001b 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -808,7 +808,7 @@ makeTensorFieldValue(const TensorSpec &spec, const TensorDataType &dataType)
const vespalib::eval::Value &asTensor(const FieldValue &fieldValue) {
auto &tensorFieldValue = dynamic_cast<const TensorFieldValue &>(fieldValue);
- auto tensor = tensorFieldValue.getAsTensorPtr();
+ const auto* tensor = tensorFieldValue.getAsTensorPtr();
assert(tensor);
return *tensor;
}
diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.cpp b/document/src/vespa/document/serialization/vespadocumentserializer.cpp
index 4a1af74d048..d309615e186 100644
--- a/document/src/vespa/document/serialization/vespadocumentserializer.cpp
+++ b/document/src/vespa/document/serialization/vespadocumentserializer.cpp
@@ -320,7 +320,7 @@ VespaDocumentSerializer::write(const WeightedSetFieldValue &value) {
void
VespaDocumentSerializer::write(const TensorFieldValue &value) {
vespalib::nbostream tmpStream;
- auto tensor = value.getAsTensorPtr();
+ const auto* tensor = value.getAsTensorPtr();
if (tensor) {
encode_value(*tensor, tmpStream);
assert( ! tmpStream.empty());
diff --git a/document/src/vespa/document/update/tensor_add_update.cpp b/document/src/vespa/document/update/tensor_add_update.cpp
index f7223b6b831..2426db5ae44 100644
--- a/document/src/vespa/document/update/tensor_add_update.cpp
+++ b/document/src/vespa/document/update/tensor_add_update.cpp
@@ -71,7 +71,7 @@ std::unique_ptr<vespalib::eval::Value>
TensorAddUpdate::apply_to(const Value &old_tensor,
const ValueBuilderFactory &factory) const
{
- if (auto addTensor = _tensor->getAsTensorPtr()) {
+ if (const auto* addTensor = _tensor->getAsTensorPtr()) {
return TensorPartialUpdate::add(old_tensor, *addTensor, factory);
}
return {};
@@ -83,7 +83,7 @@ TensorAddUpdate::applyTo(FieldValue& value) const
if (value.isA(FieldValue::Type::TENSOR)) {
TensorFieldValue &tensorFieldValue = static_cast<TensorFieldValue &>(value);
tensorFieldValue.make_empty_if_not_existing();
- auto oldTensor = tensorFieldValue.getAsTensorPtr();
+ const auto* oldTensor = tensorFieldValue.getAsTensorPtr();
assert(oldTensor);
auto newTensor = applyTo(*oldTensor);
if (newTensor) {
diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp
index 94d57ee0658..1070cc286ca 100644
--- a/document/src/vespa/document/update/tensor_modify_update.cpp
+++ b/document/src/vespa/document/update/tensor_modify_update.cpp
@@ -158,7 +158,7 @@ std::unique_ptr<Value>
TensorModifyUpdate::apply_to(const Value &old_tensor,
const ValueBuilderFactory &factory) const
{
- if (auto cellsTensor = _tensor->getAsTensorPtr()) {
+ if (const auto* cellsTensor = _tensor->getAsTensorPtr()) {
auto op = getJoinFunction(_operation);
if (_default_cell_value.has_value()) {
return TensorPartialUpdate::modify_with_defaults(old_tensor, op, *cellsTensor, _default_cell_value.value(), factory);
@@ -186,7 +186,7 @@ TensorModifyUpdate::applyTo(FieldValue& value) const
{
if (value.isA(FieldValue::Type::TENSOR)) {
TensorFieldValue &tensorFieldValue = static_cast<TensorFieldValue &>(value);
- auto old_tensor = tensorFieldValue.getAsTensorPtr();
+ const auto* old_tensor = tensorFieldValue.getAsTensorPtr();
std::unique_ptr<Value> new_tensor;
if (old_tensor) {
new_tensor = applyTo(*old_tensor);
diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp
index b9bbd96f1a2..230c451c81c 100644
--- a/document/src/vespa/document/update/tensor_remove_update.cpp
+++ b/document/src/vespa/document/update/tensor_remove_update.cpp
@@ -88,7 +88,7 @@ std::unique_ptr<vespalib::eval::Value>
TensorRemoveUpdate::apply_to(const Value &old_tensor,
const ValueBuilderFactory &factory) const
{
- if (auto addressTensor = _tensor->getAsTensorPtr()) {
+ if (const auto* addressTensor = _tensor->getAsTensorPtr()) {
return TensorPartialUpdate::remove(old_tensor, *addressTensor, factory);
}
return {};
@@ -99,7 +99,7 @@ TensorRemoveUpdate::applyTo(FieldValue &value) const
{
if (value.isA(FieldValue::Type::TENSOR)) {
TensorFieldValue &tensorFieldValue = static_cast<TensorFieldValue &>(value);
- auto oldTensor = tensorFieldValue.getAsTensorPtr();
+ const auto* oldTensor = tensorFieldValue.getAsTensorPtr();
if (oldTensor) {
auto newTensor = applyTo(*oldTensor);
if (newTensor) {
diff --git a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
index 24d0a05505b..e6c5a17baaf 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
@@ -503,7 +503,7 @@ void
AttributeUpdater::updateValue(TensorAttribute &vec, uint32_t lid, const FieldValue &val)
{
validate_field_value_type(FieldValue::Type::TENSOR, val, "TensorAttribute", "TensorFieldValue");
- const auto tensor = static_cast<const TensorFieldValue &>(val).getAsTensorPtr();
+ const auto* tensor = static_cast<const TensorFieldValue &>(val).getAsTensorPtr();
if (tensor) {
vec.setTensor(lid, *tensor);
} else {
@@ -558,7 +558,7 @@ std::unique_ptr<PrepareResult>
prepare_set_tensor(TensorAttribute& attr, uint32_t docid, const FieldValue& val)
{
validate_field_value_type(FieldValue::Type::TENSOR, val, "TensorAttribute", "TensorFieldValue");
- const auto tensor = static_cast<const TensorFieldValue&>(val).getAsTensorPtr();
+ const auto* tensor = static_cast<const TensorFieldValue&>(val).getAsTensorPtr();
if (tensor) {
return attr.prepare_set_tensor(docid, *tensor);
}
@@ -569,7 +569,7 @@ void
complete_set_tensor(TensorAttribute& attr, uint32_t docid, const FieldValue& val, std::unique_ptr<PrepareResult> prepare_result)
{
validate_field_value_type(FieldValue::Type::TENSOR, val, "TensorAttribute", "TensorFieldValue");
- const auto tensor = static_cast<const TensorFieldValue&>(val).getAsTensorPtr();
+ const auto* tensor = static_cast<const TensorFieldValue&>(val).getAsTensorPtr();
if (tensor) {
attr.complete_set_tensor(docid, *tensor, std::move(prepare_result));
} else {
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp
index 6ec65c06996..8ee9938b260 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp
@@ -325,7 +325,7 @@ SlimeFiller::visit(const WeightedSetFieldValue& value)
void
SlimeFiller::visit(const TensorFieldValue& value)
{
- const auto tensor = value.getAsTensorPtr();
+ const auto* tensor = value.getAsTensorPtr();
vespalib::nbostream s;
if (tensor) {
encode_value(*tensor, s);
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 62f749462b5..7ecda0e82f1 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -607,7 +607,7 @@ SearchVisitor::AttributeInserter::onPrimitive(uint32_t, const Content & c)
} else if (_attribute.isTensorType()) {
auto tfvalue = dynamic_cast<const document::TensorFieldValue*>(&value);
if (tfvalue != nullptr) {
- auto tensor = tfvalue->getAsTensorPtr();
+ const auto* tensor = tfvalue->getAsTensorPtr();
if (tensor != nullptr) {
attr.add(*tensor, c.getWeight());
}