Undeprecate tensorflow::StringPiece and move it under core/platform
PiperOrigin-RevId: 262283279
This commit is contained in:
parent
08ccdfb8d9
commit
a2a9e96ba8
@ -670,6 +670,7 @@ cc_library(
|
||||
"//tensorflow/core/platform:macros.h",
|
||||
"//tensorflow/core/platform:platform.h",
|
||||
"//tensorflow/core/platform:protobuf.h",
|
||||
"//tensorflow/core/platform:stringpiece.h",
|
||||
"//tensorflow/core/platform:tstring.h",
|
||||
"//tensorflow/core/platform:types.h",
|
||||
"//tensorflow/core/platform:windows/cpu_info.h",
|
||||
@ -679,11 +680,12 @@ cc_library(
|
||||
":platform_base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@double_conversion//:double-conversion",
|
||||
"//tensorflow/core/platform:macros",
|
||||
"//tensorflow/core/platform:logging",
|
||||
"//tensorflow/core/platform:platform",
|
||||
"//tensorflow/core/platform:types",
|
||||
"//tensorflow/core/platform:cpu_info",
|
||||
"//tensorflow/core/platform:logging",
|
||||
"//tensorflow/core/platform:macros",
|
||||
"//tensorflow/core/platform:platform",
|
||||
"//tensorflow/core/platform:stringpiece",
|
||||
"//tensorflow/core/platform:types",
|
||||
],
|
||||
)
|
||||
|
||||
@ -765,6 +767,7 @@ cc_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":lib_internal",
|
||||
"//tensorflow/core/platform:stringpiece",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
@ -810,16 +813,13 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
# Libraries that will eventually be moved into lib/core
|
||||
# Note that stringpiece_test can't be place here yet, because we are
|
||||
# required to use tf_cc_test, and that rule will change / into _
|
||||
# DEPRECATED: use platform:stringpiece instead.
|
||||
cc_library(
|
||||
name = "core_stringpiece",
|
||||
hdrs = ["lib/core/stringpiece.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":platform_base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core/platform:stringpiece",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2627,12 +2627,15 @@ cc_library(
|
||||
"//tensorflow/core/platform:macros.h",
|
||||
"//tensorflow/core/platform:mem.h",
|
||||
"//tensorflow/core/platform:platform.h",
|
||||
"//tensorflow/core/platform:stringpiece.h",
|
||||
"//tensorflow/core/platform:tstring.h",
|
||||
"//tensorflow/core/platform:types.h",
|
||||
],
|
||||
copts = tf_copts(),
|
||||
linkopts = ["-ldl"],
|
||||
deps = [
|
||||
":core_stringpiece",
|
||||
"//tensorflow/core/platform:stringpiece",
|
||||
"//tensorflow/core/platform/default/build_config:jpeg",
|
||||
"//tensorflow/core/platform/default/build_config:logging",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
@ -3755,7 +3758,6 @@ tf_cc_tests(
|
||||
"lib/core/notification_test.cc",
|
||||
"lib/core/refcount_test.cc",
|
||||
"lib/core/status_test.cc",
|
||||
"lib/core/stringpiece_test.cc",
|
||||
"lib/core/threadpool_test.cc",
|
||||
"lib/gtl/cleanup_test.cc",
|
||||
"lib/gtl/compactptrset_test.cc",
|
||||
@ -3805,6 +3807,7 @@ tf_cc_tests(
|
||||
"//tensorflow/core/platform:port_test.cc",
|
||||
"//tensorflow/core/platform:profile_utils/cpu_utils_test.cc",
|
||||
"//tensorflow/core/platform:stacktrace_handler_test.cc",
|
||||
"//tensorflow/core/platform:stringpiece_test.cc",
|
||||
"//tensorflow/core/platform:subprocess_test.cc",
|
||||
"//tensorflow/core/platform:vmodule_benchmark_test.cc",
|
||||
],
|
||||
@ -3816,6 +3819,7 @@ tf_cc_tests(
|
||||
":protos_all_cc",
|
||||
":test",
|
||||
":test_main",
|
||||
"//tensorflow/core/platform:stringpiece",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
|
@ -26,13 +26,6 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_CORE_LIB_CORE_STRINGPIECE_H_
|
||||
#define TENSORFLOW_CORE_LIB_CORE_STRINGPIECE_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
// Deprecated: please use absl::string_view directly.
|
||||
using StringPiece = absl::string_view;
|
||||
|
||||
} // namespace tensorflow
|
||||
#include "tensorflow/core/platform/stringpiece.h"
|
||||
|
||||
#endif // TENSORFLOW_CORE_LIB_CORE_STRINGPIECE_H_
|
||||
|
@ -160,6 +160,14 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "stringpiece",
|
||||
hdrs = ["stringpiece.h"],
|
||||
deps = [
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "tstring",
|
||||
hdrs = ["tstring.h"],
|
||||
|
37
tensorflow/core/platform/stringpiece.h
Normal file
37
tensorflow/core/platform/stringpiece.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
// StringPiece is a simple structure containing a pointer into some external
|
||||
// storage and a size. The user of a StringPiece must ensure that the slice
|
||||
// is not used after the corresponding external storage has been
|
||||
// deallocated.
|
||||
//
|
||||
// Multiple threads can invoke const methods on a StringPiece without
|
||||
// external synchronization, but if any of the threads may call a
|
||||
// non-const method, all threads accessing the same StringPiece must use
|
||||
// external synchronization.
|
||||
|
||||
#ifndef TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_
|
||||
#define TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
using StringPiece = absl::string_view;
|
||||
|
||||
} // namespace tensorflow
|
||||
|
||||
#endif // TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_
|
@ -13,9 +13,10 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/stringpiece.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
|
||||
namespace tensorflow {
|
Loading…
Reference in New Issue
Block a user