]> granicus.if.org Git - clang/commitdiff
Fix PR3635 by handling ## magically
authorChris Lattner <sabre@nondot.org>
Tue, 24 Feb 2009 05:29:33 +0000 (05:29 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 24 Feb 2009 05:29:33 +0000 (05:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/HTMLRewrite.cpp
test/Misc/emit-html.c

index cf49701a1d7d869e86b66ef26501a161059a176c..0ef998deb139317bbab55764b06fcd24c99f949b 100644 (file)
@@ -437,6 +437,11 @@ void html::HighlightMacros(Rewriter &R, FileID FID, Preprocessor& PP) {
     // 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
index 1bcab12dbc9edb97d6d3661fccc537a668504f39..c4a184584bf5b4d604f82e50953480b5de6be959 100644 (file)
@@ -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);
+}
+