[cfe-commits] r72497 - in /cfe/trunk: lib/Lex/TokenLexer.cpp test/Preprocessor/macro_paste_bad.c
Eli Friedman
eli.friedman at gmail.com
Wed May 27 15:00:39 PDT 2009
Author: efriedma
Date: Wed May 27 17:00:37 2009
New Revision: 72497
URL: http://llvm.org/viewvc/llvm-project?rev=72497&view=rev
Log:
Make the bad paste diagnostic print the entire pasted token.
Modified:
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/test/Preprocessor/macro_paste_bad.c
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=72497&r1=72496&r2=72497&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Wed May 27 17:00:37 2009
@@ -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;
Modified: cfe/trunk/test/Preprocessor/macro_paste_bad.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_paste_bad.c?rev=72497&r1=72496&r2=72497&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/macro_paste_bad.c (original)
+++ cfe/trunk/test/Preprocessor/macro_paste_bad.c Wed May 27 17:00:37 2009
@@ -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
More information about the cfe-commits
mailing list