[llvm] 96d3294 - [Support] Remove redundant calls to str() and c_str() (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 29 09:15:02 PDT 2021
Author: Kazu Hirata
Date: 2021-08-29T09:14:48-07:00
New Revision: 96d329455501dd9f7b38c6f4c5d54c7e13247dd1
URL: https://github.com/llvm/llvm-project/commit/96d329455501dd9f7b38c6f4c5d54c7e13247dd1
DIFF: https://github.com/llvm/llvm-project/commit/96d329455501dd9f7b38c6f4c5d54c7e13247dd1.diff
LOG: [Support] Remove redundant calls to str() and c_str() (NFC)
Identified with readability-redundant-string-cstr.
Added:
Modified:
llvm/lib/Support/FileUtilities.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp
index e4a86bb69de4..dbe28e56b2c3 100644
--- a/llvm/lib/Support/FileUtilities.cpp
+++ b/llvm/lib/Support/FileUtilities.cpp
@@ -300,8 +300,7 @@ llvm::Error llvm::writeFileAtomically(
std::function<llvm::Error(llvm::raw_ostream &)> Writer) {
SmallString<128> GeneratedUniqPath;
int TempFD;
- if (sys::fs::createUniqueFile(TempPathModel.str(), TempFD,
- GeneratedUniqPath)) {
+ if (sys::fs::createUniqueFile(TempPathModel, TempFD, GeneratedUniqPath)) {
return llvm::make_error<AtomicFileWriteError>(
atomic_write_error::failed_to_create_uniq_file);
}
@@ -319,8 +318,7 @@ llvm::Error llvm::writeFileAtomically(
atomic_write_error::output_stream_error);
}
- if (sys::fs::rename(/*from=*/GeneratedUniqPath.c_str(),
- /*to=*/FinalPath.str().c_str())) {
+ if (sys::fs::rename(/*from=*/GeneratedUniqPath, /*to=*/FinalPath)) {
return llvm::make_error<AtomicFileWriteError>(
atomic_write_error::failed_to_rename_temp_file);
}
More information about the llvm-commits
mailing list