Skip to content
Open
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
2 changes: 1 addition & 1 deletion tsl/platform/abi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" char* __unDName(char* output_string, const char* name,
namespace tsl {
namespace port {

string MaybeAbiDemangle(const char* name) {
std::string MaybeAbiDemangle(const char* name) {
#if defined(_MSC_VER)
std::unique_ptr<char> demangled{__unDName(nullptr, name, 0, std::malloc,
std::free,
Expand Down
12 changes: 7 additions & 5 deletions tsl/platform/coding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ limitations under the License.

#include "tsl/platform/coding.h"

#include <string>

#include "xla/tsl/platform/byte_order.h"
#include "xla/tsl/platform/types.h"
#include "tsl/platform/stringpiece.h"
Expand Down Expand Up @@ -58,19 +60,19 @@ void EncodeFixed64(char* buf, uint64 value) {
}
}

void PutFixed16(string* dst, uint16 value) {
void PutFixed16(std::string* dst, uint16 value) {
char buf[sizeof(value)];
EncodeFixed16(buf, value);
dst->append(buf, sizeof(buf));
}

void PutFixed32(string* dst, uint32 value) {
void PutFixed32(std::string* dst, uint32 value) {
char buf[sizeof(value)];
EncodeFixed32(buf, value);
dst->append(buf, sizeof(buf));
}

void PutFixed64(string* dst, uint64 value) {
void PutFixed64(std::string* dst, uint64 value) {
char buf[sizeof(value)];
EncodeFixed64(buf, value);
dst->append(buf, sizeof(buf));
Expand Down Expand Up @@ -104,7 +106,7 @@ char* EncodeVarint32(char* dst, uint32 v) {
return reinterpret_cast<char*>(ptr);
}

void PutVarint32(string* dst, uint32 v) {
void PutVarint32(std::string* dst, uint32 v) {
char buf[5];
char* ptr = EncodeVarint32(buf, v);
dst->append(buf, ptr - buf);
Expand All @@ -127,7 +129,7 @@ char* EncodeVarint64(char* dst, uint64 v) {
return reinterpret_cast<char*>(ptr);
}

void PutVarint64(string* dst, uint64 v) {
void PutVarint64(std::string* dst, uint64 v) {
char buf[10];
char* ptr = EncodeVarint64(buf, v);
dst->append(buf, ptr - buf);
Expand Down
12 changes: 7 additions & 5 deletions tsl/platform/coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ limitations under the License.
#ifndef TENSORFLOW_TSL_PLATFORM_CODING_H_
#define TENSORFLOW_TSL_PLATFORM_CODING_H_

#include <string>

#include "absl/strings/string_view.h"
#include "xla/tsl/platform/types.h"
#include "tsl/platform/stringpiece.h"
Expand All @@ -40,12 +42,12 @@ static const int kMaxVarint64Bytes = 10;
extern void EncodeFixed16(char* dst, uint16 value);
extern void EncodeFixed32(char* dst, uint32 value);
extern void EncodeFixed64(char* dst, uint64 value);
extern void PutFixed16(string* dst, uint16 value);
extern void PutFixed32(string* dst, uint32 value);
extern void PutFixed64(string* dst, uint64 value);
extern void PutFixed16(std::string* dst, uint16 value);
extern void PutFixed32(std::string* dst, uint32 value);
extern void PutFixed64(std::string* dst, uint64 value);

extern void PutVarint32(string* dst, uint32 value);
extern void PutVarint64(string* dst, uint64 value);
extern void PutVarint32(std::string* dst, uint32 value);
extern void PutVarint64(std::string* dst, uint64 value);

extern void PutVarint32(tstring* dst, uint32 value);
extern void PutVarint64(tstring* dst, uint64 value);
Expand Down
4 changes: 2 additions & 2 deletions tsl/platform/cpu_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class CPUIDInfo {
return false;
}

string vendor_str() const { return vendor_str_; }
std::string vendor_str() const { return vendor_str_; }
int family() const { return family_; }
int model_num() { return model_num_; }

Expand Down Expand Up @@ -364,7 +364,7 @@ class CPUIDInfo {
int have_sse4_2_ : 1;
int have_ssse3_ : 1;
int have_hypervisor_ : 1;
string vendor_str_;
std::string vendor_str_;
int family_;
int model_num_;
};
Expand Down
6 changes: 4 additions & 2 deletions tsl/platform/demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ limitations under the License.
#ifndef TENSORFLOW_TSL_PLATFORM_DEMANGLE_H_
#define TENSORFLOW_TSL_PLATFORM_DEMANGLE_H_

#include <string>

#include "xla/tsl/platform/types.h"

namespace tsl {
namespace port {

// If the compiler supports, demangle a mangled symbol name and return
// the demangled name. Otherwise, returns 'mangled' as is.
string Demangle(const char* mangled);
inline string Demangle(const string mangled) {
std::string Demangle(const char* mangled);
inline std::string Demangle(const std::string mangled) {
return Demangle(mangled.c_str());
}

Expand Down
4 changes: 2 additions & 2 deletions tsl/platform/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ struct hash<T*> {
};

template <>
struct hash<string> {
size_t operator()(const string& s) const {
struct hash<std::string> {
size_t operator()(const std::string& s) const {
return static_cast<size_t>(Hash64(s));
}
};
Expand Down
6 changes: 3 additions & 3 deletions tsl/platform/hash_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ TEST(StringPieceHasher, Equality) {
}

TEST(StringPieceHasher, HashMap) {
string s1("foo");
string s2("bar");
string s3("baz");
std::string s1("foo");
std::string s2("bar");
std::string s3("baz");

absl::string_view p1(s1);
absl::string_view p2(s2);
Expand Down
5 changes: 3 additions & 2 deletions tsl/platform/host_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#define TENSORFLOW_TSL_PLATFORM_HOST_INFO_H_

#include <cstdint>
#include <string>

#include "xla/tsl/platform/types.h"

Expand All @@ -37,11 +38,11 @@ struct IOStatistics {
};

// Return the hostname of the machine on which this process is running.
string Hostname();
std::string Hostname();

// Return the job name as a string if it exists, otherwise return an empty
// string.
string JobName();
std::string JobName();

// Returns the Borg job UID as an int64_t if it exists. Otherwise return -1.
int64_t JobUid();
Expand Down
4 changes: 2 additions & 2 deletions tsl/platform/human_readable_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ absl::StatusOr<std::string> ProtoToHumanReadableJson(

// Converts a string produced by ProtoToHumanReadableJSON to a protobuf. Not
// guaranteed to work for general JSON.
absl::Status HumanReadableJsonToProto(const string& str,
absl::Status HumanReadableJsonToProto(const std::string& str,
protobuf::Message* proto);
absl::Status HumanReadableJsonToProto(const string& str,
absl::Status HumanReadableJsonToProto(const std::string& str,
protobuf::MessageLite* proto);

} // namespace tsl
Expand Down
32 changes: 17 additions & 15 deletions tsl/platform/null_file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,70 +39,72 @@ class NullFileSystem : public FileSystem {
TF_USE_FILESYSTEM_METHODS_WITH_NO_TRANSACTION_SUPPORT;

absl::Status NewRandomAccessFile(
const string& fname, TransactionToken* token,
const std::string& fname, TransactionToken* token,
std::unique_ptr<RandomAccessFile>* result) override {
return errors::Unimplemented("NewRandomAccessFile unimplemented");
}

absl::Status NewWritableFile(const string& fname, TransactionToken* token,
absl::Status NewWritableFile(const std::string& fname,
TransactionToken* token,
std::unique_ptr<WritableFile>* result) override {
return errors::Unimplemented("NewWritableFile unimplemented");
}

absl::Status NewAppendableFile(
const string& fname, TransactionToken* token,
const std::string& fname, TransactionToken* token,
std::unique_ptr<WritableFile>* result) override {
return errors::Unimplemented("NewAppendableFile unimplemented");
}

absl::Status NewReadOnlyMemoryRegionFromFile(
const string& fname, TransactionToken* token,
const std::string& fname, TransactionToken* token,
std::unique_ptr<ReadOnlyMemoryRegion>* result) override {
return errors::Unimplemented(
"NewReadOnlyMemoryRegionFromFile unimplemented");
}

absl::Status FileExists(const string& fname,
absl::Status FileExists(const std::string& fname,
TransactionToken* token) override {
return errors::Unimplemented("FileExists unimplemented");
}

absl::Status GetChildren(const string& dir, TransactionToken* token,
std::vector<string>* result) override {
absl::Status GetChildren(const std::string& dir, TransactionToken* token,
std::vector<std::string>* result) override {
return errors::Unimplemented("GetChildren unimplemented");
}

absl::Status GetMatchingPaths(const string& pattern, TransactionToken* token,
std::vector<string>* results) override {
absl::Status GetMatchingPaths(const std::string& pattern,
TransactionToken* token,
std::vector<std::string>* results) override {
return internal::GetMatchingPaths(this, Env::Default(), pattern, results);
}

absl::Status DeleteFile(const string& fname,
absl::Status DeleteFile(const std::string& fname,
TransactionToken* token) override {
return errors::Unimplemented("DeleteFile unimplemented");
}

absl::Status CreateDir(const string& dirname,
absl::Status CreateDir(const std::string& dirname,
TransactionToken* token) override {
return errors::Unimplemented("CreateDir unimplemented");
}

absl::Status DeleteDir(const string& dirname,
absl::Status DeleteDir(const std::string& dirname,
TransactionToken* token) override {
return errors::Unimplemented("DeleteDir unimplemented");
}

absl::Status GetFileSize(const string& fname, TransactionToken* token,
absl::Status GetFileSize(const std::string& fname, TransactionToken* token,
uint64* file_size) override {
return errors::Unimplemented("GetFileSize unimplemented");
}

absl::Status RenameFile(const string& src, const string& target,
absl::Status RenameFile(const std::string& src, const std::string& target,
TransactionToken* token) override {
return errors::Unimplemented("RenameFile unimplemented");
}

absl::Status Stat(const string& fname, TransactionToken* token,
absl::Status Stat(const std::string& fname, TransactionToken* token,
FileStatistics* stat) override {
return errors::Unimplemented("Stat unimplemented");
}
Expand Down
2 changes: 1 addition & 1 deletion tsl/platform/numbers_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST(FpToString, Ints) {
for (int s = 0; s < 64; s++) {
for (int delta = -1; delta <= 1; delta++) {
uint64 fp = (1ull << s) + delta;
string s = FpToString(fp);
std::string s = FpToString(fp);
uint64 fp2;
EXPECT_TRUE(HexStringToUint64(s, &fp2));
EXPECT_EQ(fp, fp2);
Expand Down
Loading