Skip to content

Commit

Permalink
Replace std::string_view with absl::string_view
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 704862400
  • Loading branch information
TensorFlow Federated Team authored and copybara-github committed Dec 10, 2024
1 parent e8920e2 commit 913415c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions tensorflow_federated/cc/core/impl/aggregation/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ cc_library(
":tensor_cc_proto",
"//tensorflow_federated/cc/core/impl/aggregation/base",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@com_google_absl//absl/types:span",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@org_tensorflow//tensorflow/core/platform:tstring",
Expand Down Expand Up @@ -87,6 +88,7 @@ cc_test(
"//tensorflow_federated/cc/testing:oss_test_main",
"//tensorflow_federated/cc/testing:status_matchers",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cc_library(
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:cord",
"@com_google_absl//absl/strings:string_view",
"@org_tensorflow//tensorflow/c:checkpoint_reader",
"@org_tensorflow//tensorflow/c:tf_status_headers",
"@org_tensorflow//tensorflow/c:tf_status_helper",
Expand Down
2 changes: 2 additions & 0 deletions tensorflow_federated/cc/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cc_library(
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
],
)
Expand All @@ -49,6 +50,7 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
],
)
7 changes: 4 additions & 3 deletions tensorflow_federated/cc/testing/protobuf_matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>

#include "absl/strings/string_view.h"

#include "google/protobuf/message.h"
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/message_differencer.h"
Expand Down Expand Up @@ -253,7 +254,7 @@ class ProtoMatcher : public ProtoMatcherBase {
// as a (text format) string.
class ProtoStringMatcher : public ProtoMatcherBase {
public:
explicit ProtoStringMatcher(std::string_view expected)
explicit ProtoStringMatcher(absl::string_view expected)
: expected_(expected) {}

private:
Expand Down Expand Up @@ -318,7 +319,7 @@ inline ::testing::PolymorphicMatcher<internal_proto::ProtoMatcher> EqualsProto(
return ::testing::MakePolymorphicMatcher(internal_proto::ProtoMatcher(x));
}
inline ::testing::PolymorphicMatcher<internal_proto::ProtoStringMatcher>
EqualsProto(std::string_view x) {
EqualsProto(absl::string_view x) {
return ::testing::MakePolymorphicMatcher(
internal_proto::ProtoStringMatcher(x));
}
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_federated/cc/testing/status_matchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ limitations under the License
#include <cstdint>
#include <ostream>
#include <string>
#include <string_view>

#include "googletest/include/gtest/gtest.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"

namespace tensorflow_federated {
namespace internal_status {
Expand Down Expand Up @@ -94,7 +94,7 @@ bool CanonicalStatusIsMatcherCommonImpl::MatchAndExplain(
return true;
}

void AddFatalFailure(std::string_view expression, const char* file,
void AddFatalFailure(absl::string_view expression, const char* file,
uint32_t line, absl::Status status) {
GTEST_MESSAGE_AT_(
file, line,
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_federated/cc/testing/status_matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ limitations under the License
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>

#include "googlemock/include/gmock/gmock.h"
#include "googletest/include/gtest/gtest.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "include/grpcpp/support/status.h"

namespace tensorflow_federated {
Expand Down Expand Up @@ -290,7 +290,7 @@ class IsOkMatcher {
}
};

void AddFatalFailure(std::string_view expression, const char* file,
void AddFatalFailure(absl::string_view expression, const char* file,
uint32_t line, absl::Status status);

inline absl::Status GetStatus(absl::Status&& status) { return status; }
Expand Down

0 comments on commit 913415c

Please sign in to comment.