Rather than reimplement, use a using declaration to bring in
SmallVectorImpl<char>'s assign and append implementations in
SmallString.
The SmallString versions were missing reference invalidation
assertions from SmallVector. This patch also fixes a bug in
llvm::FileCollector::addFileImpl, which was a copy/paste from
clang::ModuleDependencyCollector::copyToRoot, both caught by the
no-longer-skipped assertions.
As a drive-by, this also sinks the const SmallVectorImpl& versions of
these methods down into SmallVectorImpl, since I imagine they'd be
useful elsewhere.
Maybe just call this inconditionally - it's probably cheap enough when the range is zero-length?
Perhaps it'd be more readable if "remove_leading_dotslash" had a version that could return the prefix length to remove.
But also, this is ultimately passed to 'getRealPath' which takes a StringRef, so there's technically no need to rewrite this SmallString - the StringRef from remove_leading_dotslash could be passed instead, something like: