Fix use-of-temporary with StringRef in code coverage (#36)

The fixed code is basically identical to the same loop below, which
might indicate an opportunity for refactoring. I just wanted to fix
the use-of-temporary issue.

Caught by adding a similar check to StringRef as r283798 did for
ArrayRef. I'll be upstreaming that soon.

Reviewed by Vedant Kumar as https://reviews.llvm.org/D26317.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286122 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed