Lex: Fix an invalid access into a SmallString

We would crash because we used operator[] to access past the end of a
SmallString.  This occured because our token had length zero.

Instead, form the pointer using .data() and arithmetic.  This is safe
because this forms a one-past-the-end pointer and it is only used to
compare with another one-past-the-end pointer.

This fixes PR21379.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220614 91177308-0d34-0410-b5e6-96231b3b80d8
Driver: assume that all architectures are supported for libstc++

Rather than asserting that the target is unsupported, make a guess at what the
tree for a port would look like and use that for the search path.

Addresses review comments from Ried Kleckner for SVN r220547.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220624 91177308-0d34-0410-b5e6-96231b3b80d8
test: attempt to make test more hermetic

Add a fake linker in to a sysroot to use for testing the driver's tool
invocation.  Should make the test behave similarly on all platforms.  Addresses
review comments from Reid Kleckner from SVN r220546.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220625 91177308-0d34-0410-b5e6-96231b3b80d8
Driver: reduce search logic duplication

Refactor the path search into a helper function to avoid duplicating the path
handling for the search.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220628 91177308-0d34-0410-b5e6-96231b3b80d8
Merge branch 'master', remote-tracking branch 'trunk/master'