Simplify code.

llvm-svn: 97324
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 774372c..beba260 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -390,7 +390,7 @@
 static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
                                     PrintPPOutputPPCallbacks *Callbacks,
                                     llvm::raw_ostream &OS) {
-  char Buffer[256];
+  llvm::SmallString<256> Buffer;
   Token PrevTok;
   while (1) {
 
@@ -406,29 +406,13 @@
       OS << ' ';
     }
 
-    if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
-      OS << II->getName();
-    } else if (Tok.isLiteral() && !Tok.needsCleaning() &&
-               Tok.getLiteralData()) {
-      OS.write(Tok.getLiteralData(), Tok.getLength());
-    } else if (Tok.getLength() < 256) {
-      const char *TokPtr = Buffer;
-      unsigned Len = PP.getSpelling(Tok, TokPtr);
-      OS.write(TokPtr, Len);
+    llvm::StringRef Str = PP.getSpelling(Tok, Buffer);
+    OS << Str;
+    // Tokens that can contain embedded newlines need to adjust our current
+    // line number.
+    if (Tok.getKind() == tok::comment)
+      Callbacks->HandleNewlinesInToken(Str.data(), Str.size());
 
-      // Tokens that can contain embedded newlines need to adjust our current
-      // line number.
-      if (Tok.getKind() == tok::comment)
-        Callbacks->HandleNewlinesInToken(TokPtr, Len);
-    } else {
-      std::string S = PP.getSpelling(Tok);
-      OS.write(&S[0], S.size());
-
-      // Tokens that can contain embedded newlines need to adjust our current
-      // line number.
-      if (Tok.getKind() == tok::comment)
-        Callbacks->HandleNewlinesInToken(&S[0], S.size());
-    }
     Callbacks->SetEmittedTokensOnThisLine();
 
     if (Tok.is(tok::eof)) break;