Make the bad paste diagnostic print the entire pasted token.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72497 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 5675f3f..318c57c 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -473,7 +473,7 @@
         // Do not emit the warning when preprocessing assembler code.
         if (!PP.getLangOptions().AsmPreprocessor)
           PP.Diag(PasteOpLoc, diag::err_pp_bad_paste)
-            << std::string(Buffer.begin(), Buffer.end()-1);
+            << std::string(Buffer.begin(), Buffer.end());
         
         // Do not consume the RHS.
         --CurToken;
diff --git a/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c
index b43d70b..c3b6179 100644
--- a/test/Preprocessor/macro_paste_bad.c
+++ b/test/Preprocessor/macro_paste_bad.c
@@ -1,7 +1,9 @@
 // RUN: clang-cc -Eonly -verify -pedantic %s
 // pasting ""x"" and ""+"" does not give a valid preprocessing token
-#define XYZ  x ## +   // expected-error {{pasting formed 'x', an invalid preprocessing token}}
+#define XYZ  x ## +   // expected-error {{pasting formed 'x+', an invalid preprocessing token}}
 XYZ
+#define XXYZ  . ## test   // expected-error {{pasting formed '.test', an invalid preprocessing token}}
+XXYZ
 
 // GCC PR 20077