[cfe-commits] r65374 - in /cfe/trunk: lib/Rewrite/HTMLRewrite.cpp test/Misc/emit-html.c
Chris Lattner
sabre at nondot.org
Mon Feb 23 21:29:33 PST 2009
Author: lattner
Date: Mon Feb 23 23:29:33 2009
New Revision: 65374
URL: http://llvm.org/viewvc/llvm-project?rev=65374&view=rev
Log:
Fix PR3635 by handling ## magically
Modified:
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/test/Misc/emit-html.c
Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=65374&r1=65373&r2=65374&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Mon Feb 23 23:29:33 2009
@@ -437,6 +437,11 @@
// preprocessor directives.
if (Tok.is(tok::hash) && Tok.isAtStartOfLine())
continue;
+
+ // If this is a ## token, change its kind to unknown so that repreprocessing
+ // it will not produce an error.
+ if (Tok.is(tok::hashhash))
+ Tok.setKind(tok::unknown);
// If this raw token is an identifier, the raw lexer won't have looked up
// the corresponding identifier info for it. Do this now so that it will be
Modified: cfe/trunk/test/Misc/emit-html.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/emit-html.c?rev=65374&r1=65373&r2=65374&view=diff
==============================================================================
--- cfe/trunk/test/Misc/emit-html.c (original)
+++ cfe/trunk/test/Misc/emit-html.c Mon Feb 23 23:29:33 2009
@@ -3,3 +3,9 @@
// rdar://6562329
#line 42 "foo.c"
+// PR3635
+#define F(fmt, ...) fmt, ## __VA_ARGS__
+int main(int argc, char **argv) {
+ return F(argc, 1);
+}
+
More information about the cfe-commits
mailing list