raw_svector_ostream: grow and reserve atomically
authorAlp Toker <alp@nuanti.com>
Fri, 11 Jul 2014 14:02:04 +0000 (14:02 +0000)
committerAlp Toker <alp@nuanti.com>
Fri, 11 Jul 2014 14:02:04 +0000 (14:02 +0000)
commit81bc6fb854c94bac32b2d687ebab92329ed1cc90
treec15252bd6a6ac6dde21a935d7e40ae4f962b1590
parentcb047f2a74666bc436eb4dea3b5893bc289d574d
raw_svector_ostream: grow and reserve atomically

Including the scratch buffer size in the initial reservation eliminates the
subsequent malloc+move operation and offers a healthier constant growth with
less memory wastage.

When doing this, take care to avoid invalidating the source buffer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212816 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/raw_ostream.cpp