From 998bf338cc21b295e1fb958cf88e49b51ee2fefd Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Sat, 18 Oct 2025 06:44:13 -0700 Subject: [PATCH] [NFC][LLVM] Override and deprecate `raw_string_ostream::flush` --- .../llvm/Analysis/BlockFrequencyInfoImpl.h | 3 --- llvm/include/llvm/Analysis/LazyCallGraph.h | 2 -- llvm/include/llvm/Support/FormatVariadic.h | 1 - llvm/include/llvm/Support/InterleavedRange.h | 1 - llvm/include/llvm/Support/raw_ostream.h | 2 ++ .../ImportedFunctionsInliningStatistics.cpp | 1 - llvm/lib/CodeGen/MIRCanonicalizerPass.cpp | 1 - llvm/lib/CodeGen/MachineBlockPlacement.cpp | 1 - llvm/lib/CodeGen/ModuloSchedule.cpp | 1 - .../CodeGen/TargetLoweringObjectFileImpl.cpp | 2 -- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 1 - llvm/lib/DebugInfo/GSYM/GsymCreator.cpp | 1 - llvm/lib/IR/Attributes.cpp | 4 ---- llvm/lib/IR/Core.cpp | 8 -------- llvm/lib/IR/DiagnosticInfo.cpp | 1 - llvm/lib/IR/Mangler.cpp | 2 -- llvm/lib/LTO/LTOCodeGenerator.cpp | 1 - llvm/lib/Object/Archive.cpp | 3 --- llvm/lib/Object/ArchiveWriter.cpp | 2 -- llvm/lib/Object/IRSymtab.cpp | 2 -- llvm/lib/ObjectYAML/DWARFEmitter.cpp | 1 - llvm/lib/ObjectYAML/WasmEmitter.cpp | 5 ----- llvm/lib/Remarks/YAMLRemarkParser.cpp | 1 - llvm/lib/Support/Chrono.cpp | 1 - llvm/tools/lli/lli.cpp | 1 - llvm/tools/llvm-cov/TestingSupport.cpp | 1 - llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp | 1 - .../llvm-exegesis/lib/BenchmarkResult.cpp | 1 - llvm/tools/llvm-ifs/llvm-ifs.cpp | 1 - llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp | 2 -- .../llvm-libtool-darwin.cpp | 1 - llvm/tools/llvm-lipo/llvm-lipo.cpp | 2 -- .../llvm-mca/Views/BottleneckAnalysis.cpp | 1 - .../llvm-mca/Views/DispatchStatistics.cpp | 2 -- llvm/tools/llvm-mca/Views/InstructionView.cpp | 1 - .../llvm-mca/Views/RegisterFileStatistics.cpp | 1 - .../Views/RetireControlUnitStatistics.cpp | 1 - llvm/tools/llvm-mca/Views/SummaryView.cpp | 1 - llvm/tools/llvm-mca/llvm-mca.cpp | 1 - llvm/tools/llvm-nm/llvm-nm.cpp | 7 ------- llvm/tools/llvm-objdump/COFFDump.cpp | 1 - llvm/tools/llvm-objdump/ELFDump.cpp | 1 - llvm/tools/llvm-objdump/MachODump.cpp | 1 - llvm/tools/llvm-objdump/WasmDump.cpp | 1 - llvm/tools/llvm-objdump/XCOFFDump.cpp | 1 - llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 3 --- llvm/tools/llvm-size/llvm-size.cpp | 2 -- llvm/tools/obj2yaml/obj2yaml.cpp | 1 - .../Frontend/HLSLRootSignatureDumpTest.cpp | 18 ------------------ llvm/unittests/Support/raw_ostream_test.cpp | 16 ---------------- 50 files changed, 2 insertions(+), 116 deletions(-) diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h index c9de5a4fa9213..b431229812297 100644 --- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h +++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h @@ -1813,7 +1813,6 @@ struct BFIDOTGraphTraitsBase : public DefaultDOTGraphTraits { raw_string_ostream OS(Result); OS << "color=\"red\""; - OS.flush(); return Result; } @@ -1872,8 +1871,6 @@ struct BFIDOTGraphTraitsBase : public DefaultDOTGraphTraits { OS << ",color=\"red\""; } } - - OS.flush(); return Str; } }; diff --git a/llvm/include/llvm/Analysis/LazyCallGraph.h b/llvm/include/llvm/Analysis/LazyCallGraph.h index 80ee72b72836d..f042f17dee2e3 100644 --- a/llvm/include/llvm/Analysis/LazyCallGraph.h +++ b/llvm/include/llvm/Analysis/LazyCallGraph.h @@ -513,7 +513,6 @@ class LazyCallGraph { std::string Name; raw_string_ostream OS(Name); OS << *this; - OS.flush(); return Name; } }; @@ -654,7 +653,6 @@ class LazyCallGraph { std::string Name; raw_string_ostream OS(Name); OS << *this; - OS.flush(); return Name; } diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h index 85652924491ba..5dab6a642c435 100644 --- a/llvm/include/llvm/Support/FormatVariadic.h +++ b/llvm/include/llvm/Support/FormatVariadic.h @@ -105,7 +105,6 @@ class formatv_object_base { std::string Result; raw_string_ostream Stream(Result); Stream << *this; - Stream.flush(); return Result; } diff --git a/llvm/include/llvm/Support/InterleavedRange.h b/llvm/include/llvm/Support/InterleavedRange.h index ce7cac98bcdd4..8f43ec1891dcd 100644 --- a/llvm/include/llvm/Support/InterleavedRange.h +++ b/llvm/include/llvm/Support/InterleavedRange.h @@ -56,7 +56,6 @@ template class InterleavedRange { std::string Result; raw_string_ostream Stream(Result); Stream << *this; - Stream.flush(); return Result; } diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h index 70916d8e4adb0..23ab2c8301bd3 100644 --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -682,6 +682,8 @@ class LLVM_ABI raw_string_ostream : public raw_ostream { void reserveExtraSpace(uint64_t ExtraSize) override { OS.reserve(tell() + ExtraSize); } + + // void flush() = delete; }; /// A raw_ostream that writes to an SmallVector or SmallString. This is a diff --git a/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp b/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp index 61715c466ae85..f550cd6e1c68e 100644 --- a/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp +++ b/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp @@ -167,7 +167,6 @@ void ImportedFunctionsInliningStatistics::dump(const bool Verbose) { "non-imported functions inlined into importing module", InlinedNotImportedFunctionsToImportingModuleCount, NotImportedFuncCount, "non-imported functions"); - Ostream.flush(); dbgs() << Out; } diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp index 7c1264e279f66..3f954da8ef319 100644 --- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp +++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp @@ -96,7 +96,6 @@ rescheduleLexographically(std::vector instructions, std::string S; raw_string_ostream OS(S); II->print(OS); - OS.flush(); // Trim the assignment, or start from the beginning in the case of a store. const size_t i = S.find('='); diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index e9c75f0753f89..f8176e225d313 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -700,7 +700,6 @@ static std::string getBlockName(const MachineBasicBlock *BB) { raw_string_ostream OS(Result); OS << printMBBReference(*BB); OS << " ('" << BB->getName() << "')"; - OS.flush(); return Result; } #endif diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index d47ed65540cf4..a8bc4dd62290b 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -2033,7 +2033,6 @@ void PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander() { std::string ScheduleDump; raw_string_ostream OS(ScheduleDump); Schedule.print(OS); - OS.flush(); // First, run the normal ModuleScheduleExpander. We don't support any // InstrChanges. diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index ae681b9aebdfb..9292cd42c3d6b 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1953,7 +1953,6 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives( raw_string_ostream OS(Flags); emitLinkerFlagsForGlobalCOFF(OS, &GV, getContext().getTargetTriple(), getMangler()); - OS.flush(); if (!Flags.empty()) { Streamer.switchSection(getDrectveSection()); Streamer.emitBytes(Flags); @@ -1978,7 +1977,6 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives( raw_string_ostream OS(Flags); emitLinkerFlagsForUsedCOFF(OS, GV, getContext().getTargetTriple(), getMangler()); - OS.flush(); if (!Flags.empty()) { Streamer.switchSection(getDrectveSection()); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 5ab80e339a1ad..aba8cc3455872 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -234,7 +234,6 @@ bool DWARFVerifier::verifyName(const DWARFDie &Die) { raw_string_ostream OS(ReconstructedName); std::string OriginalFullName; Die.getFullName(OS, &OriginalFullName); - OS.flush(); if (OriginalFullName.empty() || OriginalFullName == ReconstructedName) return false; diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp index 93ff3b924db32..dbfebd8f2fd36 100644 --- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp +++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp @@ -564,7 +564,6 @@ llvm::Error GsymCreator::saveSegments(StringRef Path, std::optional FirstFuncAddr = GC->getFirstFunctionAddress(); if (FirstFuncAddr) { SGP << Path << "-" << llvm::format_hex(*FirstFuncAddr, 1); - SGP.flush(); Err = GC->save(SegmentedGsymPath, ByteOrder, std::nullopt); if (Err) return Err; diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 4ac2ebd55dcac..291361cedc95d 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -544,7 +544,6 @@ std::string Attribute::getAsString(bool InAttrGrp) const { Result += '('; raw_string_ostream OS(Result); getValueAsType()->print(OS, false, true); - OS.flush(); Result += ')'; return Result; } @@ -660,7 +659,6 @@ std::string Attribute::getAsString(bool InAttrGrp) const { OS << getModRefStr(MR); } OS << ")"; - OS.flush(); return Result; } @@ -686,7 +684,6 @@ std::string Attribute::getAsString(bool InAttrGrp) const { OS << "i" << CR.getBitWidth() << " "; OS << CR.getLower() << ", " << CR.getUpper(); OS << ")"; - OS.flush(); return Result; } @@ -697,7 +694,6 @@ std::string Attribute::getAsString(bool InAttrGrp) const { OS << "initializes("; CRL.print(OS); OS << ")"; - OS.flush(); return Result; } diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 27d8294b01264..ccb685d6bf014 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -245,7 +245,6 @@ char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI) { DiagnosticPrinterRawOStream DP(Stream); unwrap(DI)->print(DP); - Stream.flush(); return LLVMCreateMessage(MsgStorage.c_str()); } @@ -473,7 +472,6 @@ char *LLVMPrintModuleToString(LLVMModuleRef M) { raw_string_ostream os(buf); unwrap(M)->print(os, nullptr); - os.flush(); return strdup(buf.c_str()); } @@ -651,8 +649,6 @@ char *LLVMPrintTypeToString(LLVMTypeRef Ty) { else os << "Printing Type"; - os.flush(); - return strdup(buf.c_str()); } @@ -1046,8 +1042,6 @@ char* LLVMPrintValueToString(LLVMValueRef Val) { else os << "Printing Value"; - os.flush(); - return strdup(buf.c_str()); } @@ -1064,8 +1058,6 @@ char *LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record) { else os << "Printing DbgRecord"; - os.flush(); - return strdup(buf.c_str()); } diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp index 8e6d654f6afb3..cfdce3b6a74b0 100644 --- a/llvm/lib/IR/DiagnosticInfo.cpp +++ b/llvm/lib/IR/DiagnosticInfo.cpp @@ -417,7 +417,6 @@ void DiagnosticInfoUnsupported::print(DiagnosticPrinter &DP) const { OS << getLocationStr() << ": in function " << getFunction().getName() << ' ' << *getFunction().getFunctionType() << ": " << Msg << '\n'; - OS.flush(); DP << Str; } diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp index 55c825d272a2f..43e8485434d9d 100644 --- a/llvm/lib/IR/Mangler.cpp +++ b/llvm/lib/IR/Mangler.cpp @@ -227,7 +227,6 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, std::string Flag; raw_string_ostream FlagOS(Flag); Mangler.getNameWithPrefix(FlagOS, GV, false); - FlagOS.flush(); if (Flag[0] == GV->getDataLayout().getGlobalPrefix()) OS << Flag.substr(1); else @@ -266,7 +265,6 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, std::string Flag; raw_string_ostream FlagOS(Flag); Mangler.getNameWithPrefix(FlagOS, GV, false); - FlagOS.flush(); if (Flag[0] == GV->getDataLayout().getGlobalPrefix()) OS << Flag.substr(1); else diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 8aa404da15286..46be71da5a092 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -699,7 +699,6 @@ void LTOCodeGenerator::DiagnosticHandler(const DiagnosticInfo &DI) { raw_string_ostream Stream(MsgStorage); DiagnosticPrinterRawOStream DP(Stream); DI.print(DP); - Stream.flush(); // If this method has been called it means someone has set up an external // diagnostic handler. Assert on that. diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 861c284253f7a..e63d8fd1e7d0c 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -110,7 +110,6 @@ ArchiveMemberHeader::ArchiveMemberHeader(const Archive *Parent, raw_string_ostream OS(Buf); OS.write_escaped( StringRef(ArMemHdr->Terminator, sizeof(ArMemHdr->Terminator))); - OS.flush(); std::string Msg("terminator characters in archive member \"" + Buf + "\" not the correct \"`\\n\" values for the archive " "member header "); @@ -281,7 +280,6 @@ Expected ArchiveMemberHeader::getName(uint64_t Size) const { std::string Buf; raw_string_ostream OS(Buf); OS.write_escaped(Name.substr(1).rtrim(' ')); - OS.flush(); uint64_t ArchiveOffset = reinterpret_cast(ArMemHdr) - Parent->getData().data(); return malformedError("long name offset characters after the '/' are " @@ -320,7 +318,6 @@ Expected ArchiveMemberHeader::getName(uint64_t Size) const { std::string Buf; raw_string_ostream OS(Buf); OS.write_escaped(Name.substr(3).rtrim(' ')); - OS.flush(); uint64_t ArchiveOffset = reinterpret_cast(ArMemHdr) - Parent->getData().data(); return malformedError("long name length characters after the #1/ are " diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp index a11259748b9cc..6d2bbca179836 100644 --- a/llvm/lib/Object/ArchiveWriter.cpp +++ b/llvm/lib/Object/ArchiveWriter.cpp @@ -347,7 +347,6 @@ static MemberData computeStringTable(StringRef Names) { printWithSpacePadding(Out, "//", 48); printWithSpacePadding(Out, Size + Pad, 10); Out << "`\n"; - Out.flush(); return {{}, std::move(Header), Names, Pad ? "\n" : ""}; } @@ -959,7 +958,6 @@ computeMemberData(raw_ostream &StringTable, raw_ostream &SymNames, printMemberHeader(Out, Pos, StringTable, MemberNames, Kind, Thin, *M, ModTime, Size); } - Out.flush(); std::vector Symbols; if (NeedSymbols != SymtabWritingMode::NoSymtab) { diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp index a45b34eb2e706..20610262f6a1c 100644 --- a/llvm/lib/Object/IRSymtab.cpp +++ b/llvm/lib/Object/IRSymtab.cpp @@ -317,7 +317,6 @@ Error Builder::addSymbol(const ModuleSymbolTable &Msymtab, std::string FallbackName; raw_string_ostream OS(FallbackName); Msymtab.printSymbolName(OS, Fallback); - OS.flush(); setStr(Uncommon().COFFWeakExternFallbackName, Saver.save(FallbackName)); } } @@ -341,7 +340,6 @@ Error Builder::build(ArrayRef IRMods) { if (Error Err = addModule(M)) return Err; - COFFLinkerOptsOS.flush(); setStr(Hdr.COFFLinkerOpts, Saver.save(COFFLinkerOpts)); // We are about to fill in the header's range fields, so reserve space for it diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp index ec5e08082b0ca..fbe083a663e0d 100644 --- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp +++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp @@ -1257,7 +1257,6 @@ emitDebugSectionImpl(const DWARFYAML::Data &DI, StringRef Sec, if (Error Err = EmitFunc(DebugInfoStream, DI)) return Err; - DebugInfoStream.flush(); if (!Data.empty()) OutputBuffers[Sec] = MemoryBuffer::getMemBufferCopy(Data); diff --git a/llvm/lib/ObjectYAML/WasmEmitter.cpp b/llvm/lib/ObjectYAML/WasmEmitter.cpp index 9052b4342c8c2..3e8e8cea65520 100644 --- a/llvm/lib/ObjectYAML/WasmEmitter.cpp +++ b/llvm/lib/ObjectYAML/WasmEmitter.cpp @@ -77,7 +77,6 @@ class SubSectionWriter { SubSectionWriter(raw_ostream &OS) : OS(OS), StringStream(OutString) {} void done() { - StringStream.flush(); encodeULEB128(OutString.size(), OS); OS << OutString; OutString.clear(); @@ -545,7 +544,6 @@ void WasmWriter::writeSectionContent(raw_ostream &OS, Func.Body.writeAsBinary(StringStream); // Write the section size followed by the content - StringStream.flush(); encodeULEB128(OutString.size(), OS); OS << OutString; } @@ -653,8 +651,6 @@ bool WasmWriter::writeWasm(raw_ostream &OS) { if (HasError) return false; - StringStream.flush(); - unsigned HeaderSecSizeEncodingLen = Sec->HeaderSecSizeEncodingLen.value_or(5); unsigned RequiredLen = getULEB128Size(OutString.size()); @@ -682,7 +678,6 @@ bool WasmWriter::writeWasm(raw_ostream &OS) { std::string OutString; raw_string_ostream StringStream(OutString); writeRelocSection(StringStream, *Sec, SectionIndex++); - StringStream.flush(); encodeULEB128(OutString.size(), OS); OS << OutString; diff --git a/llvm/lib/Remarks/YAMLRemarkParser.cpp b/llvm/lib/Remarks/YAMLRemarkParser.cpp index baad378d72bd4..a8b1c0cc29ad6 100644 --- a/llvm/lib/Remarks/YAMLRemarkParser.cpp +++ b/llvm/lib/Remarks/YAMLRemarkParser.cpp @@ -31,7 +31,6 @@ static void handleDiagnostic(const SMDiagnostic &Diag, void *Ctx) { Diag.print(/*ProgName=*/nullptr, OS, /*ShowColors*/ false, /*ShowKindLabels*/ true); OS << '\n'; - OS.flush(); } YAMLParseError::YAMLParseError(StringRef Msg, SourceMgr &SM, diff --git a/llvm/lib/Support/Chrono.cpp b/llvm/lib/Support/Chrono.cpp index 07a5940ddeb21..13dd7cd49b372 100644 --- a/llvm/lib/Support/Chrono.cpp +++ b/llvm/lib/Support/Chrono.cpp @@ -101,7 +101,6 @@ static void format(const T &Fractional, struct tm <, raw_ostream &OS, } FStream << Style[I]; } - FStream.flush(); char Buffer[256]; // Should be enough for anywhen. size_t Len = strftime(Buffer, sizeof(Buffer), Format.c_str(), <); OS << (Len ? Buffer : "BAD-DATE-FORMAT"); diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 7fee06b5d7b4f..914bf78de159e 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -572,7 +572,6 @@ int main(int argc, char **argv, char * const *envp) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(ArOrErr.takeError(), OS); - OS.flush(); errs() << Buf; exit(1); } diff --git a/llvm/tools/llvm-cov/TestingSupport.cpp b/llvm/tools/llvm-cov/TestingSupport.cpp index 6ad8c35d6e12f..d967b2f2a3216 100644 --- a/llvm/tools/llvm-cov/TestingSupport.cpp +++ b/llvm/tools/llvm-cov/TestingSupport.cpp @@ -38,7 +38,6 @@ int convertForTestingMain(int argc, const char *argv[]) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(ObjErr.takeError(), OS); - OS.flush(); errs() << "error: " << Buf; return 1; } diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp index 2022444931b86..be115d05ce722 100644 --- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp +++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp @@ -507,7 +507,6 @@ static void dumpArchive(const Archive *Arc) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); reportError(Arc->getFileName(), Buf); } consumeError(ChildOrErr.takeError()); diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 1823a534a301a..ad5a3f69de75f 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -297,7 +297,6 @@ template <> struct MappingContextTraits { std::string Str; raw_string_ostream OSS(Str); Binary.writeAsBinary(OSS); - OSS.flush(); Data.assign(Str.begin(), Str.end()); return Data; } diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp index e12016c51e906..9958580d3a51f 100644 --- a/llvm/tools/llvm-ifs/llvm-ifs.cpp +++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp @@ -260,7 +260,6 @@ static Error writeIFS(StringRef FilePath, IFSStub &Stub, bool WriteIfChanged) { Error YAMLErr = writeIFSToOutputStream(OutStr, Stub); if (YAMLErr) return YAMLErr; - OutStr.flush(); if (WriteIfChanged) { if (ErrorOr> BufOrError = diff --git a/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp b/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp index 1031932116c1e..d5db92e7e3166 100644 --- a/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp +++ b/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp @@ -143,8 +143,6 @@ class IR2VecTool { MaxRelation = std::max(MaxRelation, FuncMaxRelation); } - RelOS.flush(); - // Write metadata header followed by relationships OS << "MAX_RELATION=" << MaxRelation << '\n'; OS << Relationships; diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index 94247118dc4eb..4165274a6f8bd 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -572,7 +572,6 @@ checkForDuplicates(const MembersPerArchitectureMap &MembersPerArch) { } } - ErrorStream.flush(); if (ErrorData.size() > 0) return createStringError(std::errc::invalid_argument, ErrorData.c_str()); } diff --git a/llvm/tools/llvm-lipo/llvm-lipo.cpp b/llvm/tools/llvm-lipo/llvm-lipo.cpp index 3e1d4165e8ed7..d9200570c2b2b 100644 --- a/llvm/tools/llvm-lipo/llvm-lipo.cpp +++ b/llvm/tools/llvm-lipo/llvm-lipo.cpp @@ -49,7 +49,6 @@ static const StringRef ToolName = "llvm-lipo"; std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); reportError(Buf); } @@ -58,7 +57,6 @@ static const StringRef ToolName = "llvm-lipo"; std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); WithColor::error(errs(), ToolName) << "'" << File << "': " << Buf; exit(EXIT_FAILURE); } diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp index e7d8083da19d2..3fa90546b83a8 100644 --- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp +++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp @@ -635,7 +635,6 @@ void BottleneckAnalysis::printView(raw_ostream &OS) const { std::string Buffer; raw_string_ostream TempStream(Buffer); printBottleneckHints(TempStream); - TempStream.flush(); OS << Buffer; printCriticalSequence(OS); } diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp index 3dc17c8754d80..d6978a53be92b 100644 --- a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp @@ -44,7 +44,6 @@ void DispatchStatistics::printDispatchHistogram(raw_ostream &OS) const { << "%)\n"; } - TempStream.flush(); OS << Buffer; } @@ -79,7 +78,6 @@ void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const { SS << "\nUSH - Uncategorised Structural Hazard: "; printStalls(SS, HWStalls[HWStallEvent::CustomBehaviourStall], NumCycles); SS << '\n'; - SS.flush(); OS << Buffer; } diff --git a/llvm/tools/llvm-mca/Views/InstructionView.cpp b/llvm/tools/llvm-mca/Views/InstructionView.cpp index 3b174a0649852..a747437fd2b93 100644 --- a/llvm/tools/llvm-mca/Views/InstructionView.cpp +++ b/llvm/tools/llvm-mca/Views/InstructionView.cpp @@ -25,7 +25,6 @@ StringRef InstructionView::printInstructionString(const llvm::MCInst &MCI) const { InstructionString = ""; MCIP.printInst(&MCI, 0, "", STI, InstrStream); - InstrStream.flush(); // Remove any tabs or spaces at the beginning of the instruction. return StringRef(InstructionString).ltrim(); } diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp index 54566dc860c57..2eb2b301b9359 100644 --- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp @@ -162,7 +162,6 @@ void RegisterFileStatistics::printView(raw_ostream &OS) const { } } - TempStream.flush(); OS << Buffer; } diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp index 1c40428fb0182..abb78f19e8e04 100644 --- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp @@ -83,7 +83,6 @@ void RetireControlUnitStatistics::printView(raw_ostream &OS) const { << "\nAverage Used ROB Entries per cy: " << AvgUsage << format(" ( %.1f%% )\n", NormalizedAvgPercentage); - TempStream.flush(); OS << Buffer; } diff --git a/llvm/tools/llvm-mca/Views/SummaryView.cpp b/llvm/tools/llvm-mca/Views/SummaryView.cpp index bf258b4c26b15..7cf338756293d 100644 --- a/llvm/tools/llvm-mca/Views/SummaryView.cpp +++ b/llvm/tools/llvm-mca/Views/SummaryView.cpp @@ -79,7 +79,6 @@ void SummaryView::printView(raw_ostream &OS) const { TempStream << "\nBlock RThroughput: " << format("%.1f", floor((DV.BlockRThroughput * 10) + 0.5) / 10) << '\n'; - TempStream.flush(); OS << Buffer; } diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index a64539c09b81e..1c153dbd713d8 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -654,7 +654,6 @@ int main(int argc, char **argv) { << ", use -skip-unsupported-instructions=lack-sched to " "ignore these on the input.\n"; IP->printInst(&IE.Inst, 0, "", *STI, SS); - SS.flush(); WithColor::note() << "instruction: " << InstructionStr << '\n'; })) { diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index dcfc0f92590d5..bf250fbea6e6b 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -194,7 +194,6 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); errs() << ": " << Buf << "\n"; } @@ -213,7 +212,6 @@ static void error(llvm::Error E, StringRef FileName, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); errs() << ": " << Buf << "\n"; } @@ -1404,7 +1402,6 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO, error(std::move(Err), MachO.getFileName()); // Set the symbol names and indirect names for the added symbols. if (ExportsAdded) { - EOS.flush(); const char *Q = ExportsNameBuffer.c_str(); for (unsigned K = 0; K < ExportsAdded; K++) { SymbolList[I].Name = Q; @@ -1457,7 +1454,6 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO, error(std::move(BErr), MachO.getFileName()); // Set the symbol names and indirect names for the added symbols. if (BindsAdded) { - BOS.flush(); const char *Q = BindsNameBuffer.c_str(); for (unsigned K = 0; K < BindsAdded; K++) { SymbolList[I].Name = Q; @@ -1516,7 +1512,6 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO, error(std::move(LErr), MachO.getFileName()); // Set the symbol names and indirect names for the added symbols. if (LazysAdded) { - LOS.flush(); const char *Q = LazysNameBuffer.c_str(); for (unsigned K = 0; K < LazysAdded; K++) { SymbolList[I].Name = Q; @@ -1584,7 +1579,6 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO, error(std::move(WErr), MachO.getFileName()); // Set the symbol names and indirect names for the added symbols. if (WeaksAdded) { - WOS.flush(); const char *Q = WeaksNameBuffer.c_str(); for (unsigned K = 0; K < WeaksAdded; K++) { SymbolList[I].Name = Q; @@ -1675,7 +1669,6 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO, } } if (FunctionStartsAdded) { - FOS.flush(); const char *Q = FunctionStartsNameBuffer.c_str(); for (unsigned K = 0; K < FunctionStartsAdded; K++) { SymbolList[I].Name = Q; diff --git a/llvm/tools/llvm-objdump/COFFDump.cpp b/llvm/tools/llvm-objdump/COFFDump.cpp index de825612c089d..155b23f064d34 100644 --- a/llvm/tools/llvm-objdump/COFFDump.cpp +++ b/llvm/tools/llvm-objdump/COFFDump.cpp @@ -841,7 +841,6 @@ void objdump::printCOFFSymbolTable(const object::COFFImportFile &i) { raw_string_ostream NS(Name); cantFail(Sym.printName(NS)); - NS.flush(); outs() << "[" << format("%2d", Index) << "]" << "(sec " << format("%2d", 0) << ")" diff --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp index 1e7bb00916cd7..6e345063d3651 100644 --- a/llvm/tools/llvm-objdump/ELFDump.cpp +++ b/llvm/tools/llvm-objdump/ELFDump.cpp @@ -164,7 +164,6 @@ static Error getRelocationValueString(const ELFObjectFile *Obj, : "+") << format("0x%" PRIx64, (Addend < 0 ? -(uint64_t)Addend : (uint64_t)Addend)); } - Fmt.flush(); Result.append(FmtBuf.begin(), FmtBuf.end()); return Error::success(); } diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index 8e9c91fde544d..b2053b4af1ba4 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -589,7 +589,6 @@ Error objdump::getMachORelocationValueString(const MachOObjectFile *Obj, } else printRelocationTargetName(Obj, RE, Fmt); - Fmt.flush(); Result.append(FmtBuf.begin(), FmtBuf.end()); return Error::success(); } diff --git a/llvm/tools/llvm-objdump/WasmDump.cpp b/llvm/tools/llvm-objdump/WasmDump.cpp index 56c084750b7d0..1a59afc02a437 100644 --- a/llvm/tools/llvm-objdump/WasmDump.cpp +++ b/llvm/tools/llvm-objdump/WasmDump.cpp @@ -60,7 +60,6 @@ Error objdump::getWasmRelocationValueString(const WasmObjectFile *Obj, Result.append(SymName.begin(), SymName.end()); } Fmt << (Rel.Addend < 0 ? "" : "+") << Rel.Addend; - Fmt.flush(); Result.append(FmtBuf.begin(), FmtBuf.end()); return Error::success(); } diff --git a/llvm/tools/llvm-objdump/XCOFFDump.cpp b/llvm/tools/llvm-objdump/XCOFFDump.cpp index 61dd0b8713979..0e7896a7a25a3 100644 --- a/llvm/tools/llvm-objdump/XCOFFDump.cpp +++ b/llvm/tools/llvm-objdump/XCOFFDump.cpp @@ -129,7 +129,6 @@ void XCOFFDumper::checkAndPrintAuxHeaderParseError( if (PartialFieldOffset < AuxSize) { std::string Buf; raw_string_ostream OS(Buf); - OS.flush(); OS << FormattedString("Raw data", 0, FormattedString::JustifyLeft) << " (" << format_bytes( ArrayRef(reinterpret_cast(&AuxHeader) + diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 922241eb9da62..d13b89e667bf5 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -434,7 +434,6 @@ static int printLineInfoForInput(bool LoadObjects, bool UseDebugObj) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(MaybeObj.takeError(), OS); - OS.flush(); ErrorAndExit("unable to create object file: '" + Buf + "'"); } @@ -570,7 +569,6 @@ static int executeInput() { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(MaybeObj.takeError(), OS); - OS.flush(); ErrorAndExit("unable to create object file: '" + Buf + "'"); } @@ -976,7 +974,6 @@ static int linkAndVerify() { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(MaybeObj.takeError(), OS); - OS.flush(); ErrorAndExit("unable to create object file: '" + Buf + "'"); } diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp index ec94db4ff7382..400fcdf7b6fa6 100644 --- a/llvm/tools/llvm-size/llvm-size.cpp +++ b/llvm/tools/llvm-size/llvm-size.cpp @@ -131,7 +131,6 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); errs() << ": " << Buf << "\n"; } @@ -149,7 +148,6 @@ static void error(llvm::Error E, StringRef FileName, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); - OS.flush(); errs() << ": " << Buf << "\n"; } diff --git a/llvm/tools/obj2yaml/obj2yaml.cpp b/llvm/tools/obj2yaml/obj2yaml.cpp index 94c38d1032c22..37937a9d6ba70 100644 --- a/llvm/tools/obj2yaml/obj2yaml.cpp +++ b/llvm/tools/obj2yaml/obj2yaml.cpp @@ -94,7 +94,6 @@ static void reportError(StringRef Input, Error Err) { std::string ErrMsg; raw_string_ostream OS(ErrMsg); logAllUnhandledErrors(std::move(Err), OS); - OS.flush(); errs() << "Error reading file: " << Input << ": " << ErrMsg; errs().flush(); } diff --git a/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp b/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp index 451c376219c38..f499ae4220ace 100644 --- a/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp +++ b/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp @@ -23,7 +23,6 @@ TEST(HLSLRootSignatureTest, DescriptorCBVClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "CBV(b0, numDescriptors = 1, space = 0, " "offset = DescriptorTableOffsetAppend, " @@ -43,7 +42,6 @@ TEST(HLSLRootSignatureTest, DescriptorSRVClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "SRV(t0, numDescriptors = unbounded, space = 42, " "offset = 3, flags = None)"; @@ -69,7 +67,6 @@ TEST(HLSLRootSignatureTest, DescriptorUAVClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "UAV(u92374, numDescriptors = 3298, space = 932847, offset = 1, flags = " @@ -93,7 +90,6 @@ TEST(HLSLRootSignatureTest, DescriptorSamplerClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "Sampler(s0, numDescriptors = 2, space = 42, offset = " "DescriptorTableOffsetAppend, " @@ -110,7 +106,6 @@ TEST(HLSLRootSignatureTest, DescriptorCBVV10ClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "CBV(b0, numDescriptors = 1, space = 0, " "offset = DescriptorTableOffsetAppend, " @@ -127,7 +122,6 @@ TEST(HLSLRootSignatureTest, DescriptorSamplerV10ClauseDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Clause; - OS.flush(); std::string Expected = "Sampler(s0, numDescriptors = 1, space = 0, offset = " "DescriptorTableOffsetAppend, " @@ -143,7 +137,6 @@ TEST(HLSLRootSignatureTest, DescriptorTableDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Table; - OS.flush(); std::string Expected = "DescriptorTable(numClauses = 4, visibility = Geometry)"; @@ -159,7 +152,6 @@ TEST(HLSLRootSignatureTest, RootCBVDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Descriptor; - OS.flush(); std::string Expected = "RootCBV(b0, space = 0, " "visibility = All, " @@ -176,7 +168,6 @@ TEST(HLSLRootSignatureTest, RootSRV10Dump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Descriptor; - OS.flush(); std::string Expected = "RootSRV(t0, space = 0, " "visibility = All, " @@ -193,7 +184,6 @@ TEST(HLSLRootSignatureTest, RootUAVV10Dump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Descriptor; - OS.flush(); std::string Expected = "RootUAV(u0, space = 0, " "visibility = All, " @@ -212,7 +202,6 @@ TEST(HLSLRootSignatureTest, RootSRVDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Descriptor; - OS.flush(); std::string Expected = "RootSRV(t0, space = 42, visibility = Geometry, flags = None)"; @@ -235,7 +224,6 @@ TEST(HLSLRootSignatureTest, RootUAVDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Descriptor; - OS.flush(); std::string Expected = "RootUAV(u92374, space = 932847, visibility = Hull, flags = " @@ -252,7 +240,6 @@ TEST(HLSLRootSignatureTest, DefaultStaticSamplerDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Sampler; - OS.flush(); std::string Expected = "StaticSampler(s0, " "filter = Anisotropic, " @@ -293,7 +280,6 @@ TEST(HLSLRootSignatureTest, DefinedStaticSamplerDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Sampler; - OS.flush(); std::string Expected = "StaticSampler(s0, " "filter = ComparisonMinMagLinearMipPoint, " @@ -321,7 +307,6 @@ TEST(HLSLRootSignatureTest, DefaultRootConstantsDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Constants; - OS.flush(); std::string Expected = "RootConstants(num32BitConstants = 1, b3, space = 0, " "visibility = All)"; @@ -338,7 +323,6 @@ TEST(HLSLRootSignatureTest, SetRootConstantsDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Constants; - OS.flush(); std::string Expected = "RootConstants(num32BitConstants = 983, b34593, " "space = 7, visibility = Pixel)"; @@ -351,7 +335,6 @@ TEST(HLSLRootSignatureTest, NoneRootFlagsDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << Flags; - OS.flush(); std::string Expected = "RootFlags(None)"; EXPECT_EQ(Out, Expected); @@ -375,7 +358,6 @@ TEST(HLSLRootSignatureTest, AllRootFlagsDump) { std::string Out; llvm::raw_string_ostream OS(Out); OS << ValidRootFlags; - OS.flush(); std::string Expected = "RootFlags(" "AllowInputAssemblerInputLayout | " diff --git a/llvm/unittests/Support/raw_ostream_test.cpp b/llvm/unittests/Support/raw_ostream_test.cpp index 8f9ed4143a873..124dc4ee68966 100644 --- a/llvm/unittests/Support/raw_ostream_test.cpp +++ b/llvm/unittests/Support/raw_ostream_test.cpp @@ -27,7 +27,6 @@ template std::string printToString(const T &Value) { llvm::raw_string_ostream OS(res); OS.SetBuffered(); OS << Value; - OS.flush(); return res; } @@ -136,17 +135,6 @@ TEST(raw_ostreamTest, BufferEdge) { EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 10)); } -TEST(raw_ostreamTest, TinyBuffer) { - std::string Str; - raw_string_ostream OS(Str); - OS.SetBufferSize(1); - OS << "hello"; - OS << 1; - OS << 'w' << 'o' << 'r' << 'l' << 'd'; - OS.flush(); - EXPECT_EQ("hello1world", Str); -} - TEST(raw_ostreamTest, WriteEscaped) { std::string Str; @@ -256,7 +244,6 @@ formatted_bytes_str(ArrayRef Bytes, std::string S; raw_string_ostream Str(S); Str << format_bytes(Bytes, Offset, NumPerLine, ByteGroupSize); - Str.flush(); return S; } @@ -266,7 +253,6 @@ static std::string format_bytes_with_ascii_str( std::string S; raw_string_ostream Str(S); Str << format_bytes_with_ascii(Bytes, Offset, NumPerLine, ByteGroupSize); - Str.flush(); return S; } @@ -491,7 +477,6 @@ TEST(raw_ostreamTest, flush_tied_to_stream_on_write) { TiedStream << "0"; EXPECT_EQ("acego", TiedToBuffer); - TiedTo.flush(); TiedStream.flush(); } @@ -553,7 +538,6 @@ TEST(raw_ostreamTest, reserve_stream) { OS << "hello"; OS << 1; OS << 'w' << 'o' << 'r' << 'l' << 'd'; - OS.flush(); EXPECT_EQ("11111111111111111111hello1world", Str); }