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)
commit255907042245b77779e3e38c5ce66901866cabe5
tree92db65aa99c37ab5f68cd6adaae1d8cf6d629b8f
parentce6e7c7a59e8595ea3f30d87cbad4af278cb5ef3
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.

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