Introduce a string_ostream string builder facilty
authorAlp Toker <alp@nuanti.com>
Thu, 26 Jun 2014 00:00:48 +0000 (00:00 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 26 Jun 2014 00:00:48 +0000 (00:00 +0000)
commit614717388cfccd6a6d34ed17a4680181e22cab22
tree98ceaaca266d95b9e657783de3452ee20f891178
parent49f09fd88afbf04a2c661c1917665b46f96729fa
Introduce a string_ostream string builder facilty

string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

llvm-svn: 211749
57 files changed:
llvm/include/llvm/Analysis/CFGPrinter.h
llvm/include/llvm/ExecutionEngine/ObjectBuffer.h
llvm/include/llvm/Support/GraphWriter.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/include/llvm/Support/raw_ostream.h
llvm/include/llvm/TableGen/StringToOffsetTable.h
llvm/lib/Analysis/Analysis.cpp
llvm/lib/Analysis/BlockFrequencyInfo.cpp
llvm/lib/Analysis/Lint.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/MachineScheduler.cpp
llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
llvm/lib/CodeGen/TargetSchedule.cpp
llvm/lib/DebugInfo/DWARFDebugFrame.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/DataLayout.cpp
llvm/lib/IR/LLVMContext.cpp
llvm/lib/IRReader/IRReader.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCDisassembler/Disassembler.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/Option/Arg.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/raw_ostream.cpp
llvm/lib/TableGen/SetTheory.cpp
llvm/lib/TableGen/TGParser.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/TargetMachineC.cpp
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/XCore/XCoreAsmPrinter.cpp
llvm/lib/Transforms/Instrumentation/DebugIR.cpp
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
llvm/lib/Transforms/Utils/ASanStackFrameLayout.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/tools/llvm-ar/llvm-ar.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
llvm/tools/llvm-readobj/Win64EHDumper.cpp
llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
llvm/utils/FileCheck/FileCheck.cpp
llvm/utils/TableGen/CodeEmitterGen.cpp
llvm/utils/yaml-bench/YAMLBench.cpp