Note! this compiles but breaks tests, it's not ready. I must have made an error somewhere.
I'm keeping it in Phabricator hoping to continue fixing it time permitting.
If anyone else is interested in taking over, feel free.
This is an attempt in making SmallString::str() return std::string.
The first phase required making SmallString an equal-rights citizen in LLVM.
There were four use-cases for SmallString::str():
1 Input to a twine or StringRef accepting function.
2 << streaming to raw_stream.
3 Select an overloaded function accepting Twine and StringRef.
4 Really convert to std::string.
To solve 1 and 2, I extended Twine and raw_stream to accept SmallVectorImpl<char>.
This made most hundreds of existing .str() calls redundant which is very nice.
3 was solved by either adding a SmallVectorImpl<char>-accepting function or
For 4, where std::string was really required, I added std::string SmallString::to_str().
.str() can not be reused immediatly as all the existing .str() code would compile OK but
with performance regressions due to the creation of std::string instead of a StringRef.
All .str() users must be reviewed to be removed most of the time or modified into
to_str() before we can reuse .str().