Use StringRef and ArrayRef return values when buf passed.

For functions where a SmallVector is passed to be used as a stack buffer for
the return value, have the return value be the appropriate StringRef or
ArrayRef type.  This allows for both more natural usage and enables directly
returning (rather than copying) a permanently stored or constant string.
This commit is contained in:
Peter Johnson
2016-09-10 21:30:39 -07:00
parent c4ceec145a
commit 052f746c68
11 changed files with 141 additions and 125 deletions

View File

@@ -258,9 +258,9 @@ HTTPSinkImpl::HTTPSinkImpl(llvm::StringRef name, llvm::StringRef description,
HTTPSinkImpl::~HTTPSinkImpl() { Stop(); }
void HTTPSinkImpl::GetDescription(llvm::SmallVectorImpl<char>& desc) const {
llvm::raw_svector_ostream oss{desc};
oss << m_description;
llvm::StringRef HTTPSinkImpl::GetDescription(
llvm::SmallVectorImpl<char>& buf) const {
return m_description;
}
void HTTPSinkImpl::Stop() {