Add an overload of Preprocessor::getSpelling which takes a SmallVector and
returns a StringRef. Use it to simplify some repetitive code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97322 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index df0e702..84ce062 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -503,10 +503,8 @@
   } else {
     // Cleaning needed, alloca a buffer, clean into it, then use the buffer.
     llvm::SmallVector<char, 64> IdentifierBuffer;
-    IdentifierBuffer.resize(Identifier.getLength());
-    const char *TmpBuf = &IdentifierBuffer[0];
-    unsigned Size = getSpelling(Identifier, TmpBuf);
-    II = getIdentifierInfo(llvm::StringRef(TmpBuf, Size));
+    llvm::StringRef CleanedStr = getSpelling(Identifier, IdentifierBuffer);
+    II = getIdentifierInfo(CleanedStr);
   }
   Identifier.setIdentifierInfo(II);
   return II;