diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-28 09:07:14 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-28 09:11:17 -0700 |
commit | f8f5bbe006bc98e98fd939898ceff08dbaace34f (patch) | |
tree | 0ce731cb888e678790f69923788decfb58a7a9cb /tensorflow | |
parent | 2cb954e5441605c8668d2aecbf12e324a07b3c89 (diff) |
Removed ToString method from tensorflow::StringPiece.
This will make it easier to replace tensorflow::StringPiece with absl::string_view, as absl::string_view does not contain a ToString method.
PiperOrigin-RevId: 210550029
Diffstat (limited to 'tensorflow')
5 files changed, 8 insertions, 12 deletions
diff --git a/tensorflow/core/grappler/optimizers/data/filter_fusion_test.cc b/tensorflow/core/grappler/optimizers/data/filter_fusion_test.cc index 5a289e60d0..12b1924efd 100644 --- a/tensorflow/core/grappler/optimizers/data/filter_fusion_test.cc +++ b/tensorflow/core/grappler/optimizers/data/filter_fusion_test.cc @@ -30,7 +30,7 @@ namespace { NodeDef MakeFilterNode(StringPiece name, StringPiece input_node_name) { return test::function::NDef( - name, "FilterDataset", {input_node_name.ToString()}, + name, "FilterDataset", {string(input_node_name)}, {{"predicate", FunctionDefHelper::FunctionRef("IsZero")}, {"Targuments", {}}, {"output_shapes", {}}, diff --git a/tensorflow/core/lib/core/stringpiece.h b/tensorflow/core/lib/core/stringpiece.h index be659e5f8e..02dded42c1 100644 --- a/tensorflow/core/lib/core/stringpiece.h +++ b/tensorflow/core/lib/core/stringpiece.h @@ -92,10 +92,6 @@ class StringPiece { StringPiece substr(size_t pos, size_t n = npos) const; - // Return a string that contains the copy of the referenced data. - // DEPRECATED: use std::string(sv) instead. - std::string ToString() const { return std::string(data_, size_); } - // Three-way comparison. Returns value: // < 0 iff "*this" < "b", // == 0 iff "*this" == "b", diff --git a/tensorflow/core/platform/s3/s3_file_system.cc b/tensorflow/core/platform/s3/s3_file_system.cc index 462113f9bb..ce0f6cd741 100644 --- a/tensorflow/core/platform/s3/s3_file_system.cc +++ b/tensorflow/core/platform/s3/s3_file_system.cc @@ -150,13 +150,13 @@ Status ParseS3Path(const string& fname, bool empty_object_ok, string* bucket, return errors::InvalidArgument("S3 path doesn't start with 's3://': ", fname); } - *bucket = bucketp.ToString(); + *bucket = string(bucketp); if (bucket->empty() || *bucket == ".") { return errors::InvalidArgument("S3 path doesn't contain a bucket name: ", fname); } str_util::ConsumePrefix(&objectp, "/"); - *object = objectp.ToString(); + *object = string(objectp); if (!empty_object_ok && object->empty()) { return errors::InvalidArgument("S3 path doesn't contain an object name: ", fname); diff --git a/tensorflow/core/platform/windows/windows_file_system.h b/tensorflow/core/platform/windows/windows_file_system.h index 6b04720c68..1f4c535f24 100644 --- a/tensorflow/core/platform/windows/windows_file_system.h +++ b/tensorflow/core/platform/windows/windows_file_system.h @@ -71,7 +71,7 @@ class LocalWinFileSystem : public WindowsFileSystem { string TranslateName(const string& name) const override { StringPiece scheme, host, path; io::ParseURI(name, &scheme, &host, &path); - return path.ToString(); + return string(path); } }; diff --git a/tensorflow/stream_executor/dso_loader.cc b/tensorflow/stream_executor/dso_loader.cc index 114143b3ab..ea5dffd15e 100644 --- a/tensorflow/stream_executor/dso_loader.cc +++ b/tensorflow/stream_executor/dso_loader.cc @@ -121,7 +121,7 @@ static mutex& GetRpathMutex() { /* static */ void DsoLoader::RegisterRpath(port::StringPiece path) { mutex_lock lock{GetRpathMutex()}; - GetRpaths()->push_back(path.ToString()); + GetRpaths()->emplace_back(path); } /* static */ port::Status DsoLoader::GetDsoHandle(port::StringPiece path, @@ -131,7 +131,7 @@ static mutex& GetRpathMutex() { return port::Status(port::error::INVALID_ARGUMENT, "Only LoadKind::kLocal is currently supported"); } - string path_string = path.ToString(); + string path_string(path); port::Status s = port::Env::Default()->LoadLibrary(path_string.c_str(), dso_handle); if (!s.ok()) { @@ -154,7 +154,7 @@ static mutex& GetRpathMutex() { /* static */ string DsoLoader::GetBinaryDirectory(bool strip_executable_name) { string exe_path = port::Env::Default()->GetExecutablePath(); - return strip_executable_name ? port::Dirname(exe_path).ToString() : exe_path; + return strip_executable_name ? string(port::Dirname(exe_path)) : exe_path; } // Creates a heap-allocated vector for initial rpaths. @@ -212,7 +212,7 @@ static std::vector<string>* CreatePrimordialRpaths() { } attempted.push_back(candidate); - return library_name.ToString(); + return string(library_name); } /* static */ string DsoLoader::GetCudaLibraryDirPath() { |