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)
commitbc4d1a36047bae030871accdaf51c943304ef342
treeb1f203db605ee7e81a10f4f69983c7d9542f14ac
parent03f1e408dee68ff5a3cd9da49ebaa7d56a2b39d2
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.

llvm-svn: 212816
llvm/lib/Support/raw_ostream.cpp