diff options
author | Kazu Hirata <kazu@google.com> | 2024-01-19 18:54:11 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2024-01-19 18:54:11 -0800 |
commit | b7a66d0faeb1d2838e89c3632ba7835e6c2af6cc (patch) | |
tree | 95351026452241df6e74eee6623af3e90104861c | |
parent | c0396e15c348b17b6de7005ee057160812e29ad8 (diff) | |
download | llvm-b7a66d0faeb1d2838e89c3632ba7835e6c2af6cc.zip llvm-b7a66d0faeb1d2838e89c3632ba7835e6c2af6cc.tar.gz llvm-b7a66d0faeb1d2838e89c3632ba7835e6c2af6cc.tar.bz2 |
[llvm] Use SmallString::operator std::string (NFC)
20 files changed, 25 insertions, 25 deletions
diff --git a/llvm/include/llvm/ADT/APFixedPoint.h b/llvm/include/llvm/ADT/APFixedPoint.h index 5442968..b0c5108 100644 --- a/llvm/include/llvm/ADT/APFixedPoint.h +++ b/llvm/include/llvm/ADT/APFixedPoint.h @@ -235,7 +235,7 @@ public: std::string toString() const { SmallString<40> S; toString(S); - return std::string(S.str()); + return std::string(S); } void print(raw_ostream &) const; diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index c6fb8b6..a2436892 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -332,7 +332,7 @@ inline std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral = false) { SmallString<40> S; I.toString(S, Radix, Signed, formatAsCLiteral); - return std::string(S.str()); + return std::string(S); } inline std::string toString(const APSInt &I, unsigned Radix) { diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h index 66c7d10..395c9e33 100644 --- a/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -1715,7 +1715,7 @@ public: SmallString<256> NewName(Name); NewName += ".llvm."; NewName += Suffix; - return std::string(NewName.str()); + return std::string(NewName); } /// Helper to obtain the unpromoted name for a global value (or the original diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h index f91f21d..24f9954 100644 --- a/llvm/include/llvm/Object/MachO.h +++ b/llvm/include/llvm/Object/MachO.h @@ -826,7 +826,7 @@ public: Version = utostr(major) + "." + utostr(minor); if (update != 0) Version += "." + utostr(update); - return std::string(std::string(Version.str())); + return std::string(std::string(Version)); } /// If the input path is a .dSYM bundle (as created by the dsymutil tool), diff --git a/llvm/include/llvm/TableGen/StringToOffsetTable.h b/llvm/include/llvm/TableGen/StringToOffsetTable.h index 7fcf20a..66bcc81 100644 --- a/llvm/include/llvm/TableGen/StringToOffsetTable.h +++ b/llvm/include/llvm/TableGen/StringToOffsetTable.h @@ -45,7 +45,7 @@ public: // Escape the string. SmallString<256> Str; raw_svector_ostream(Str).write_escaped(AggregateString); - AggregateString = std::string(Str.str()); + AggregateString = std::string(Str); O << " \""; unsigned CharsPrinted = 0; diff --git a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp index 6c85f9a..bcb8b94 100644 --- a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp @@ -218,7 +218,7 @@ static void analyzeImportedModule( ReportWarning(Twine("Conflicting parseable interfaces for Swift Module ") + *Name + ": " + Entry + " and " + Path, DIE); - Entry = std::string(ResolvedPath.str()); + Entry = std::string(ResolvedPath); } /// The distinct types of work performed by the work loop in diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp index 2122647..fe2748f 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp @@ -294,7 +294,7 @@ void CompileUnit::analyzeImportedModule(const DWARFDebugInfoEntry *DieEntry) { ": " + Entry + " and " + Path + ".", &Die); } - Entry = std::string(ResolvedPath.str()); + Entry = std::string(ResolvedPath); } } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp index 78792cf..28f0564 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -1456,7 +1456,7 @@ bool DWARFDebugLine::Prologue::getFileNameByIndex( // sys::path::append skips empty strings. sys::path::append(FilePath, Style, IncludeDir, FileName); - Result = std::string(FilePath.str()); + Result = std::string(FilePath); return true; } diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 37806be..5f29226 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -303,7 +303,7 @@ std::string getDarwinDWARFResourceForPath(const std::string &Path, } sys::path::append(ResourceName, "Contents", "Resources", "DWARF"); sys::path::append(ResourceName, Basename); - return std::string(ResourceName.str()); + return std::string(ResourceName); } bool checkFileCRC(StringRef Path, uint32_t CRCHash) { diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 7abb9e9..31c290a 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -197,7 +197,7 @@ std::string ExecutionEngine::getMangledName(const GlobalValue *GV) { : GV->getParent()->getDataLayout(); Mangler::getNameWithPrefix(FullName, GV->getName(), DL); - return std::string(FullName.str()); + return std::string(FullName); } void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) { diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp index 5e06231..f7852b0 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp @@ -323,7 +323,7 @@ static Error InitDebuggingDir(PerfState &State) { return make_error<StringError>(std::move(ErrStr), inconvertibleErrorCode()); } - State.JitPath = std::string(UniqueDebugDir.str()); + State.JitPath = std::string(UniqueDebugDir); return Error::success(); } diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 6a1e53b..b38c568 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1573,7 +1573,7 @@ std::string lto::getThinLTOOutputFile(StringRef Path, StringRef OldPrefix, llvm::errs() << "warning: could not create directory '" << ParentPath << "': " << EC.message() << '\n'; } - return std::string(NewPath.str()); + return std::string(NewPath); } namespace { diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 443439b..535faf5 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -947,11 +947,11 @@ ThinLTOCodeGenerator::writeGeneratedObject(int count, StringRef CacheEntryPath, // Cache is enabled, hard-link the entry (or copy if hard-link fails). auto Err = sys::fs::create_hard_link(CacheEntryPath, OutputPath); if (!Err) - return std::string(OutputPath.str()); + return std::string(OutputPath); // Hard linking failed, try to copy. Err = sys::fs::copy_file(CacheEntryPath, OutputPath); if (!Err) - return std::string(OutputPath.str()); + return std::string(OutputPath); // Copy failed (could be because the CacheEntry was removed from the cache // in the meantime by another process), fall back and try to write down the // buffer to the output. @@ -964,7 +964,7 @@ ThinLTOCodeGenerator::writeGeneratedObject(int count, StringRef CacheEntryPath, if (Err) report_fatal_error(Twine("Can't open output '") + OutputPath + "'\n"); OS << OutputBuffer.getBuffer(); - return std::string(OutputPath.str()); + return std::string(OutputPath); } // Main entry point for the ThinLTO processing diff --git a/llvm/lib/LineEditor/LineEditor.cpp b/llvm/lib/LineEditor/LineEditor.cpp index bb40841..d0d138b 100644 --- a/llvm/lib/LineEditor/LineEditor.cpp +++ b/llvm/lib/LineEditor/LineEditor.cpp @@ -25,7 +25,7 @@ std::string LineEditor::getDefaultHistoryPath(StringRef ProgName) { SmallString<32> Path; if (sys::path::home_directory(Path)) { sys::path::append(Path, "." + ProgName + "-history"); - return std::string(Path.str()); + return std::string(Path); } return std::string(); } diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 4ac4d72..e447e5b 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -567,7 +567,7 @@ Expected<std::string> Archive::Child::getFullName() const { SmallString<128> FullName = sys::path::parent_path( Parent->getMemoryBufferRef().getBufferIdentifier()); sys::path::append(FullName, Name); - return std::string(FullName.str()); + return std::string(FullName); } Expected<StringRef> Archive::Child::getBuffer() const { diff --git a/llvm/lib/ProfileData/GCOV.cpp b/llvm/lib/ProfileData/GCOV.cpp index f7bf42e..fcfeb5b 100644 --- a/llvm/lib/ProfileData/GCOV.cpp +++ b/llvm/lib/ProfileData/GCOV.cpp @@ -666,7 +666,7 @@ static std::string mangleCoveragePath(StringRef Filename, bool PreservePaths) { if (S < I) Result.append(S, I); - return std::string(Result.str()); + return std::string(Result); } std::string Context::getCoveragePath(StringRef filename, diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 1c140ed..5d7ec0f 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -67,7 +67,7 @@ public: static std::string getDefaultOutputPath(const NewArchiveMember &FirstMember) { SmallString<128> Val = StringRef(FirstMember.Buf->getBufferIdentifier()); sys::path::replace_extension(Val, ".lib"); - return std::string(Val.str()); + return std::string(Val); } static std::vector<StringRef> getSearchPaths(opt::InputArgList *Args, diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 1ff0a34..c7f6f2a 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -535,7 +535,7 @@ std::string GCOVProfiler::mangleName(const DICompileUnit *CU, SmallString<128> Filename = GCovFile->getString(); sys::path::replace_extension(Filename, Notes ? "gcno" : "gcda"); - return std::string(Filename.str()); + return std::string(Filename); } } @@ -546,7 +546,7 @@ std::string GCOVProfiler::mangleName(const DICompileUnit *CU, if (sys::fs::current_path(CurPath)) return std::string(FName); sys::path::append(CurPath, FName); - return std::string(CurPath.str()); + return std::string(CurPath); } bool GCOVProfiler::runOnModule( diff --git a/llvm/lib/Transforms/Utils/NameAnonGlobals.cpp b/llvm/lib/Transforms/Utils/NameAnonGlobals.cpp index f41a14c..9655cb9 100644 --- a/llvm/lib/Transforms/Utils/NameAnonGlobals.cpp +++ b/llvm/lib/Transforms/Utils/NameAnonGlobals.cpp @@ -54,7 +54,7 @@ public: Hasher.final(Hash); SmallString<32> Result; MD5::stringifyResult(Hash, Result); - TheHash = std::string(Result.str()); + TheHash = std::string(Result); return TheHash; } }; diff --git a/llvm/lib/WindowsDriver/MSVCPaths.cpp b/llvm/lib/WindowsDriver/MSVCPaths.cpp index b69ee11..634cfcb 100644 --- a/llvm/lib/WindowsDriver/MSVCPaths.cpp +++ b/llvm/lib/WindowsDriver/MSVCPaths.cpp @@ -328,7 +328,7 @@ bool appendArchToWindowsSDKLibPath(int SDKMajor, SmallString<128> LibPath, } } - path = std::string(LibPath.str()); + path = std::string(LibPath); return true; } @@ -383,7 +383,7 @@ std::string getSubDirectoryPath(SubDirectoryType Type, ToolsetLayout VSLayout, sys::path::append(Path, "lib", SubdirName); break; } - return std::string(Path.str()); + return std::string(Path); } bool useUniversalCRT(ToolsetLayout VSLayout, const std::string &VCToolChainPath, @@ -720,7 +720,7 @@ bool findVCToolChainViaRegistry(std::string &Path, ToolsetLayout &VSLayout) { SmallString<256> VCPath(StringRef(VSInstallPath.c_str(), pos)); sys::path::append(VCPath, "VC"); - Path = std::string(VCPath.str()); + Path = std::string(VCPath); VSLayout = ToolsetLayout::OlderVS; return true; } |