diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc index d12cd1647ed..0fa4b87cff2 100644 --- a/lib/Support/Unix/PathV2.inc +++ b/lib/Support/Unix/PathV2.inc @@ -71,8 +71,8 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) { // Get arguments. SmallString<128> from_storage; SmallString<128> to_storage; - StringRef f = from.toStringRef(from_storage); - StringRef t = to.toStringRef(to_storage); + StringRef f = from.toNullTerminatedStringRef(from_storage); + StringRef t = to.toNullTerminatedStringRef(to_storage); const size_t buf_sz = 32768; char buffer[buf_sz]; diff --git a/lib/Support/Windows/PathV2.inc b/lib/Support/Windows/PathV2.inc index cb80731c1c3..b1f8ae00d3d 100644 --- a/lib/Support/Windows/PathV2.inc +++ b/lib/Support/Windows/PathV2.inc @@ -104,8 +104,8 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) { // Get arguments. SmallString<128> from_storage; SmallString<128> to_storage; - StringRef f = from.toStringRef(from_storage); - StringRef t = to.toStringRef(to_storage); + StringRef f = from.toNullTerminatedStringRef(from_storage); + StringRef t = to.toNullTerminatedStringRef(to_storage); // Convert to utf-16. SmallVector wide_from;