Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions xls/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ cc_library(
cc_library(
name = "proto_adaptor_utils",
hdrs = ["proto_adaptor_utils.h"],
deps = ["@com_google_absl//absl/base:core_headers"],
)

cc_library(
Expand Down Expand Up @@ -119,16 +120,6 @@ cc_test(
],
)

cc_test(
name = "proto_adaptor_utils_test",
srcs = ["proto_adaptor_utils_test.cc"],
deps = [
":proto_adaptor_utils",
":xls_gunit_main",
"@googletest//:gtest",
],
)

cc_library(
name = "case_converters",
srcs = ["case_converters.cc"],
Expand Down
16 changes: 7 additions & 9 deletions xls/common/proto_adaptor_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
#ifndef XLS_COMMON_PROTO_ADAPTOR_UTILS_H_
#define XLS_COMMON_PROTO_ADAPTOR_UTILS_H_

#include <string>
#include <string_view>

#include "absl/base/macros.h"

namespace xls {

// Returns a string type with contents equivalent to the string view.
// The generated proto API for strings does not support string_view assignment.
//
// This gives us a convenient way to note which "string view to string"
// conversions are done "just for conformance with the open source API's need
// for full `std::string`s" -- if at some point the protobuf APIs are upgraded
// in open source, all of these conversion calls could be removed.
inline std::string ToProtoString(std::string_view s) { return std::string(s); }
// Previously, this function marked places where we had to construct a
// std::string to conform to an API that demanded a string, but we anticipated
// would eventually change to accept string_view. That day has come.
ABSL_DEPRECATE_AND_INLINE()
inline std::string_view ToProtoString(std::string_view s) { return s; }

} // namespace xls

Expand Down
33 changes: 0 additions & 33 deletions xls/common/proto_adaptor_utils_test.cc

This file was deleted.